From: Martin Küttler Date: Fri, 5 Jan 2024 12:45:20 +0000 (+0000) Subject: libstdc++: Remove unneeded double operation in src/c++17/fs_path.cc X-Git-Tag: basepoints/gcc-15~3180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3fee5ef891cc8e4f39fe118ab5a3e875fcc7088;p=thirdparty%2Fgcc.git libstdc++: Remove unneeded double operation in src/c++17/fs_path.cc libstdc++-v3/ChangeLog: * src/c++17/fs_path.cc (path::_List::reserve): Avoid floating-point arithmetic. --- diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc index 4e41b891c2c6..a2d3c54a88a4 100644 --- a/libstdc++-v3/src/c++17/fs_path.cc +++ b/libstdc++-v3/src/c++17/fs_path.cc @@ -447,8 +447,9 @@ path::_List::reserve(int newcap, bool exact = false) if (curcap < newcap) { - if (!exact && newcap < int(1.5 * curcap)) - newcap = 1.5 * curcap; + const int nextcap = curcap + curcap / 2; + if (!exact && newcap < nextcap) + newcap = nextcap; void* p = ::operator new(sizeof(_Impl) + newcap * sizeof(value_type)); std::unique_ptr<_Impl, _Impl_deleter> newptr(::new(p) _Impl{newcap});