From c9f1cab30fef2f176759a009a438e50456d3b65a Mon Sep 17 00:00:00 2001 From: mkuettle <117156110+mkuettle@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:45:13 +0100 Subject: [PATCH] `1.5 * curcap` -> `curcap + curcap / 2` in fs_path.cc This change has two ihmo positive implications: - The implicit conversion from double to int is avoided (Avoiding a warning). - No double is used at all, which could be significant in some scenarios. --- libstdc++-v3/src/c++17/fs_path.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc index d65b5482e8b96..c8f29b02ab0ac 100644 --- a/libstdc++-v3/src/c++17/fs_path.cc +++ b/libstdc++-v3/src/c++17/fs_path.cc @@ -447,8 +447,8 @@ path::_List::reserve(int newcap, bool exact = false) if (curcap < newcap) { - if (!exact && newcap < int(1.5 * curcap)) - newcap = 1.5 * curcap; + if (!exact && newcap < curcap + curcap / 2) + newcap = curcap + curcap / 2; void* p = ::operator new(sizeof(_Impl) + newcap * sizeof(value_type)); std::unique_ptr<_Impl, _Impl_deleter> newptr(::new(p) _Impl{newcap});