[libcxx-commits] [libcxx] 6e67928 - [libc++][NFC] _VSTD -> std in ryu

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 6 21:10:37 PST 2023


Author: Louis Dionne
Date: 2023-02-06T21:08:55-08:00
New Revision: 6e67928642c25822c101316c5e03bb2a18b56715

URL: https://github.com/llvm/llvm-project/commit/6e67928642c25822c101316c5e03bb2a18b56715
DIFF: https://github.com/llvm/llvm-project/commit/6e67928642c25822c101316c5e03bb2a18b56715.diff

LOG: [libc++][NFC] _VSTD -> std in ryu

Those ones are extremely mechanical and since that's not libc++ code
in the first place, there's even more of an incentive to do the rename.

Added: 
    

Modified: 
    libcxx/src/include/ryu/common.h
    libcxx/src/ryu/d2fixed.cpp
    libcxx/src/ryu/d2s.cpp
    libcxx/src/ryu/f2s.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/src/include/ryu/common.h b/libcxx/src/include/ryu/common.h
index c24115c23364e..a29b2436faf29 100644
--- a/libcxx/src/include/ryu/common.h
+++ b/libcxx/src/include/ryu/common.h
@@ -91,13 +91,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __float_to_bits(const float __f) {
   uint32_t __bits = 0;
-  _VSTD::memcpy(&__bits, &__f, sizeof(float));
+  std::memcpy(&__bits, &__f, sizeof(float));
   return __bits;
 }
 
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint64_t __double_to_bits(const double __d) {
   uint64_t __bits = 0;
-  _VSTD::memcpy(&__bits, &__d, sizeof(double));
+  std::memcpy(&__bits, &__d, sizeof(double));
   return __bits;
 }
 

diff  --git a/libcxx/src/ryu/d2fixed.cpp b/libcxx/src/ryu/d2fixed.cpp
index c1a1f6cf9e05d..305fbb42c4925 100644
--- a/libcxx/src/ryu/d2fixed.cpp
+++ b/libcxx/src/ryu/d2fixed.cpp
@@ -135,19 +135,19 @@ void __append_n_digits(const uint32_t __olength, uint32_t __digits, char* const
     __digits /= 10000;
     const uint32_t __c0 = (__c % 100) << 1;
     const uint32_t __c1 = (__c / 100) << 1;
-    _VSTD::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + __olength - __i - 4, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + __olength - __i - 4, __DIGIT_TABLE + __c1, 2);
     __i += 4;
   }
   if (__digits >= 100) {
     const uint32_t __c = (__digits % 100) << 1;
     __digits /= 100;
-    _VSTD::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c, 2);
     __i += 2;
   }
   if (__digits >= 10) {
     const uint32_t __c = __digits << 1;
-    _VSTD::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __olength - __i - 2, __DIGIT_TABLE + __c, 2);
   } else {
     __result[0] = static_cast<char>('0' + __digits);
   }
@@ -164,14 +164,14 @@ _LIBCPP_HIDE_FROM_ABI inline void __append_d_digits(const uint32_t __olength, ui
     __digits /= 10000;
     const uint32_t __c0 = (__c % 100) << 1;
     const uint32_t __c1 = (__c / 100) << 1;
-    _VSTD::memcpy(__result + __olength + 1 - __i - 2, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + __olength + 1 - __i - 4, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + __olength + 1 - __i - 2, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + __olength + 1 - __i - 4, __DIGIT_TABLE + __c1, 2);
     __i += 4;
   }
   if (__digits >= 100) {
     const uint32_t __c = (__digits % 100) << 1;
     __digits /= 100;
-    _VSTD::memcpy(__result + __olength + 1 - __i - 2, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __olength + 1 - __i - 2, __DIGIT_TABLE + __c, 2);
     __i += 2;
   }
   if (__digits >= 10) {
@@ -190,7 +190,7 @@ _LIBCPP_HIDE_FROM_ABI inline void __append_c_digits(const uint32_t __count, uint
   for (; __i < __count - 1; __i += 2) {
     const uint32_t __c = (__digits % 100) << 1;
     __digits /= 100;
-    _VSTD::memcpy(__result + __count - __i - 2, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __count - __i - 2, __DIGIT_TABLE + __c, 2);
   }
   if (__i < __count) {
     const char __c = static_cast<char>('0' + (__digits % 10));
@@ -200,7 +200,7 @@ _LIBCPP_HIDE_FROM_ABI inline void __append_c_digits(const uint32_t __count, uint
 
 void __append_nine_digits(uint32_t __digits, char* const __result) {
   if (__digits == 0) {
-    _VSTD::memset(__result, '0', 9);
+    std::memset(__result, '0', 9);
     return;
   }
 
@@ -213,8 +213,8 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
     __digits /= 10000;
     const uint32_t __c0 = (__c % 100) << 1;
     const uint32_t __c1 = (__c / 100) << 1;
-    _VSTD::memcpy(__result + 7 - __i, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + 5 - __i, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + 7 - __i, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + 5 - __i, __DIGIT_TABLE + __c1, 2);
   }
   __result[0] = static_cast<char>('0' + __digits);
 }
@@ -251,7 +251,7 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
     *_First++ = '0';
     if (__precision > 0) {
       *_First++ = '.';
-      _VSTD::memset(_First, '0', __precision);
+      std::memset(_First, '0', __precision);
       _First += __precision;
     }
     return { _First, errc{} };
@@ -322,14 +322,14 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
       if (_Last - _First < static_cast<ptr
diff _t>(__precision)) {
         return { _Last, errc::value_too_large };
       }
-      _VSTD::memset(_First, '0', __precision);
+      std::memset(_First, '0', __precision);
       _First += __precision;
     } else if (__i < __MIN_BLOCK_2[__idx]) {
       __i = __MIN_BLOCK_2[__idx];
       if (_Last - _First < static_cast<ptr
diff _t>(9 * __i)) {
         return { _Last, errc::value_too_large };
       }
-      _VSTD::memset(_First, '0', 9 * __i);
+      std::memset(_First, '0', 9 * __i);
       _First += 9 * __i;
     }
     for (; __i < __blocks; ++__i) {
@@ -342,7 +342,7 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
         if (_Last - _First < static_cast<ptr
diff _t>(__fill)) {
           return { _Last, errc::value_too_large };
         }
-        _VSTD::memset(_First, '0', __fill);
+        std::memset(_First, '0', __fill);
         _First += __fill;
         break;
       }
@@ -416,7 +416,7 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
     if (_Last - _First < static_cast<ptr
diff _t>(__precision)) {
       return { _Last, errc::value_too_large };
     }
-    _VSTD::memset(_First, '0', __precision);
+    std::memset(_First, '0', __precision);
     _First += __precision;
   }
   return { _First, errc{} };
@@ -440,10 +440,10 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
     *_First++ = '0';
     if (__precision > 0) {
       *_First++ = '.';
-      _VSTD::memset(_First, '0', __precision);
+      std::memset(_First, '0', __precision);
       _First += __precision;
     }
-    _VSTD::memcpy(_First, "e+00", 4);
+    std::memcpy(_First, "e+00", 4);
     _First += 4;
     return { _First, errc{} };
   }
@@ -589,7 +589,7 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
       return { _Last, errc::value_too_large };
     }
     if (__digits == 0) {
-      _VSTD::memset(_First, '0', __maximum);
+      std::memset(_First, '0', __maximum);
     } else {
       __append_c_digits(__maximum, __digits, _First);
     }
@@ -654,11 +654,11 @@ void __append_nine_digits(uint32_t __digits, char* const __result) {
 
   if (__exp >= 100) {
     const int32_t __c = __exp % 10;
-    _VSTD::memcpy(_First, __DIGIT_TABLE + 2 * (__exp / 10), 2);
+    std::memcpy(_First, __DIGIT_TABLE + 2 * (__exp / 10), 2);
     _First[2] = static_cast<char>('0' + __c);
     _First += 3;
   } else {
-    _VSTD::memcpy(_First, __DIGIT_TABLE + 2 * __exp, 2);
+    std::memcpy(_First, __DIGIT_TABLE + 2 * __exp, 2);
     _First += 2;
   }
 

diff  --git a/libcxx/src/ryu/d2s.cpp b/libcxx/src/ryu/d2s.cpp
index 245c2eb5908d4..ede260713ddf8 100644
--- a/libcxx/src/ryu/d2s.cpp
+++ b/libcxx/src/ryu/d2s.cpp
@@ -527,10 +527,10 @@ struct __floating_decimal_64 {
       const uint32_t __d0 = (__d % 100) << 1;
       const uint32_t __d1 = (__d / 100) << 1;
 
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __d0, 2);
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __d1, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __d0, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __d1, 2);
     }
     uint32_t __output2 = static_cast<uint32_t>(_Output);
     while (__output2 >= 10000) {
@@ -542,35 +542,35 @@ struct __floating_decimal_64 {
       __output2 /= 10000;
       const uint32_t __c0 = (__c % 100) << 1;
       const uint32_t __c1 = (__c / 100) << 1;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
     }
     if (__output2 >= 100) {
       const uint32_t __c = (__output2 % 100) << 1;
       __output2 /= 100;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
     }
     if (__output2 >= 10) {
       const uint32_t __c = __output2 << 1;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
     } else {
       *--_Mid = static_cast<char>('0' + __output2);
     }
 
     if (_Ryu_exponent > 0) { // case "172900" with _Can_use_ryu
       // Performance note: it might be more efficient to do this immediately after setting _Mid.
-      _VSTD::memset(_First + __olength, '0', static_cast<size_t>(_Ryu_exponent));
+      std::memset(_First + __olength, '0', static_cast<size_t>(_Ryu_exponent));
     } else if (_Ryu_exponent == 0) { // case "1729"
       // Done!
     } else if (_Whole_digits > 0) { // case "17.29"
       // Performance note: moving digits might not be optimal.
-      _VSTD::memmove(_First, _First + 1, static_cast<size_t>(_Whole_digits));
+      std::memmove(_First, _First + 1, static_cast<size_t>(_Whole_digits));
       _First[_Whole_digits] = '.';
     } else { // case "0.001729"
       // Performance note: a larger memset() followed by overwriting '.' might be more efficient.
       _First[0] = '0';
       _First[1] = '.';
-      _VSTD::memset(_First + 2, '0', static_cast<size_t>(-_Whole_digits));
+      std::memset(_First + 2, '0', static_cast<size_t>(-_Whole_digits));
     }
 
     return { _First + _Total_fixed_length, errc{} };
@@ -602,10 +602,10 @@ struct __floating_decimal_64 {
     const uint32_t __c1 = (__c / 100) << 1;
     const uint32_t __d0 = (__d % 100) << 1;
     const uint32_t __d1 = (__d / 100) << 1;
-    _VSTD::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
-    _VSTD::memcpy(__result + __olength - __i - 5, __DIGIT_TABLE + __d0, 2);
-    _VSTD::memcpy(__result + __olength - __i - 7, __DIGIT_TABLE + __d1, 2);
+    std::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + __olength - __i - 5, __DIGIT_TABLE + __d0, 2);
+    std::memcpy(__result + __olength - __i - 7, __DIGIT_TABLE + __d1, 2);
     __i += 8;
   }
   uint32_t __output2 = static_cast<uint32_t>(_Output);
@@ -618,14 +618,14 @@ struct __floating_decimal_64 {
     __output2 /= 10000;
     const uint32_t __c0 = (__c % 100) << 1;
     const uint32_t __c1 = (__c / 100) << 1;
-    _VSTD::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
     __i += 4;
   }
   if (__output2 >= 100) {
     const uint32_t __c = (__output2 % 100) << 1;
     __output2 /= 100;
-    _VSTD::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c, 2);
     __i += 2;
   }
   if (__output2 >= 10) {
@@ -657,11 +657,11 @@ struct __floating_decimal_64 {
 
   if (_Scientific_exponent >= 100) {
     const int32_t __c = _Scientific_exponent % 10;
-    _VSTD::memcpy(__result + __index, __DIGIT_TABLE + 2 * (_Scientific_exponent / 10), 2);
+    std::memcpy(__result + __index, __DIGIT_TABLE + 2 * (_Scientific_exponent / 10), 2);
     __result[__index + 2] = static_cast<char>('0' + __c);
     __index += 3;
   } else {
-    _VSTD::memcpy(__result + __index, __DIGIT_TABLE + 2 * _Scientific_exponent, 2);
+    std::memcpy(__result + __index, __DIGIT_TABLE + 2 * _Scientific_exponent, 2);
     __index += 2;
   }
 
@@ -713,7 +713,7 @@ struct __floating_decimal_64 {
         return { _Last, errc::value_too_large };
       }
 
-      _VSTD::memcpy(_First, "0e+00", 5);
+      std::memcpy(_First, "0e+00", 5);
 
       return { _First + 5, errc{} };
     }

diff  --git a/libcxx/src/ryu/f2s.cpp b/libcxx/src/ryu/f2s.cpp
index 3bcfe462c8f75..db93a48656a6a 100644
--- a/libcxx/src/ryu/f2s.cpp
+++ b/libcxx/src/ryu/f2s.cpp
@@ -565,35 +565,35 @@ struct __floating_decimal_32 {
       _Output /= 10000;
       const uint32_t __c0 = (__c % 100) << 1;
       const uint32_t __c1 = (__c / 100) << 1;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c0, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c1, 2);
     }
     if (_Output >= 100) {
       const uint32_t __c = (_Output % 100) << 1;
       _Output /= 100;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
     }
     if (_Output >= 10) {
       const uint32_t __c = _Output << 1;
-      _VSTD::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
+      std::memcpy(_Mid -= 2, __DIGIT_TABLE + __c, 2);
     } else {
       *--_Mid = static_cast<char>('0' + _Output);
     }
 
     if (_Ryu_exponent > 0) { // case "172900" with _Can_use_ryu
       // Performance note: it might be more efficient to do this immediately after setting _Mid.
-      _VSTD::memset(_First + __olength, '0', static_cast<size_t>(_Ryu_exponent));
+      std::memset(_First + __olength, '0', static_cast<size_t>(_Ryu_exponent));
     } else if (_Ryu_exponent == 0) { // case "1729"
       // Done!
     } else if (_Whole_digits > 0) { // case "17.29"
       // Performance note: moving digits might not be optimal.
-      _VSTD::memmove(_First, _First + 1, static_cast<size_t>(_Whole_digits));
+      std::memmove(_First, _First + 1, static_cast<size_t>(_Whole_digits));
       _First[_Whole_digits] = '.';
     } else { // case "0.001729"
       // Performance note: a larger memset() followed by overwriting '.' might be more efficient.
       _First[0] = '0';
       _First[1] = '.';
-      _VSTD::memset(_First + 2, '0', static_cast<size_t>(-_Whole_digits));
+      std::memset(_First + 2, '0', static_cast<size_t>(-_Whole_digits));
     }
 
     return { _First + _Total_fixed_length, errc{} };
@@ -617,14 +617,14 @@ struct __floating_decimal_32 {
     _Output /= 10000;
     const uint32_t __c0 = (__c % 100) << 1;
     const uint32_t __c1 = (__c / 100) << 1;
-    _VSTD::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
-    _VSTD::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
+    std::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c0, 2);
+    std::memcpy(__result + __olength - __i - 3, __DIGIT_TABLE + __c1, 2);
     __i += 4;
   }
   if (_Output >= 100) {
     const uint32_t __c = (_Output % 100) << 1;
     _Output /= 100;
-    _VSTD::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c, 2);
+    std::memcpy(__result + __olength - __i - 1, __DIGIT_TABLE + __c, 2);
     __i += 2;
   }
   if (_Output >= 10) {
@@ -654,7 +654,7 @@ struct __floating_decimal_32 {
     __result[__index++] = '+';
   }
 
-  _VSTD::memcpy(__result + __index, __DIGIT_TABLE + 2 * _Scientific_exponent, 2);
+  std::memcpy(__result + __index, __DIGIT_TABLE + 2 * _Scientific_exponent, 2);
   __index += 2;
 
   return { _First + _Total_scientific_length, errc{} };
@@ -673,7 +673,7 @@ struct __floating_decimal_32 {
         return { _Last, errc::value_too_large };
       }
 
-      _VSTD::memcpy(_First, "0e+00", 5);
+      std::memcpy(_First, "0e+00", 5);
 
       return { _First + 5, errc{} };
     }


        


More information about the libcxx-commits mailing list