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.
This commit is contained in:
Martin Küttler 2024-01-05 12:45:20 +00:00 committed by Jonathan Wakely
parent 57fa5b60bb
commit a3fee5ef89

View file

@ -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});