This is a small change to libstdc++ which does not change any behavior.

This change has two, ihmo positive, implications:

 - The implicit conversion from double to int is avoided (Avoiding a
   warning).

 - No floating point number is used at all, which could be significant
   in some scenarios.

------------
diff --git a/libstdc++-v3/src/c++17/fs_path.cc 
b/libstdc++-v3/src/c++17/fs_path.cc
index d65b5482e8b..b47ed0aa7aa 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});


-- 
Kernkonzept GmbH at Dresden, Germany, HRB 31129, CEO Dr.-Ing. Michael Hohmuth

Reply via email to