[libc-commits] [libc] [llvm] Revert "[libc][NFC] Remove __support/bit.h and use __support/CPP/bit.h instead" (PR #74444)

via libc-commits libc-commits at lists.llvm.org
Tue Dec 5 02:27:49 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff b14094885077fb10ae688a4cae85f7cfee795fb3 4fdb9338fbe534521d9e79035561d9ca9db399c6 -- libc/src/__support/bit.h libc/test/src/__support/bit_test.cpp libc/src/__support/FPUtil/FPBits.h libc/src/__support/FPUtil/Hypot.h libc/src/__support/FPUtil/generic/FMA.h libc/src/__support/FPUtil/generic/FMod.h libc/src/__support/FPUtil/generic/sqrt.h libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h libc/src/__support/HashTable/bitmask.h libc/src/__support/HashTable/table.h libc/src/__support/UInt.h libc/src/__support/hash.h libc/src/__support/integer_utils.h libc/src/__support/memory_size.h libc/src/__support/str_to_float.h libc/src/math/generic/powf.cpp libc/src/string/memory_utils/op_builtin.h libc/src/string/memory_utils/utils.h libc/test/src/__support/HashTable/table_test.cpp libc/test/src/__support/memory_size_test.cpp libc/test/src/search/hsearch_test.cpp libc/test/src/string/memory_utils/utils_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/FPUtil/Hypot.h b/libc/src/__support/FPUtil/Hypot.h
index db2a62fbdf..4575813086 100644
--- a/libc/src/__support/FPUtil/Hypot.h
+++ b/libc/src/__support/FPUtil/Hypot.h
@@ -37,9 +37,13 @@ LIBC_INLINE T find_leading_one(T mant, int &shift_length) {
 
 template <typename T> struct DoubleLength;
 
-template <> struct DoubleLength<uint16_t> { using Type = uint32_t; };
+template <> struct DoubleLength<uint16_t> {
+  using Type = uint32_t;
+};
 
-template <> struct DoubleLength<uint32_t> { using Type = uint64_t; };
+template <> struct DoubleLength<uint32_t> {
+  using Type = uint64_t;
+};
 
 template <> struct DoubleLength<uint64_t> {
   using Type = UInt128;
diff --git a/libc/src/__support/FPUtil/generic/FMod.h b/libc/src/__support/FPUtil/generic/FMod.h
index 6f934cd4a8..afc3d2297d 100644
--- a/libc/src/__support/FPUtil/generic/FMod.h
+++ b/libc/src/__support/FPUtil/generic/FMod.h
@@ -229,7 +229,7 @@ private:
 
     if (LIBC_LIKELY(sx.uintval() <= sy.uintval())) {
       if (sx.uintval() < sy.uintval())
-        return sx;        // |x|<|y| return x
+        return sx;             // |x|<|y| return x
       return FPB(FPB::zero()); // |x|=|y| return 0.0
     }
 
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index b93fa7a35f..6b89ecd48e 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -137,7 +137,7 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> sqrt(T x) {
 
       // We compute one more iteration in order to round correctly.
       bool lsb = static_cast<bool>(y & 1); // Least significant bit
-      bool rb = false;  // Round bit
+      bool rb = false;                     // Round bit
       r <<= 2;
       UIntType tmp = (y << 2) + 1;
       if (r >= tmp) {
diff --git a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
index a3bf7e3cab..6364d7c1fb 100644
--- a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
+++ b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h
@@ -101,7 +101,7 @@ LIBC_INLINE long double sqrt(long double x) {
 
     // We compute one more iteration in order to round correctly.
     bool lsb = static_cast<bool>(y & 1); // Least significant bit
-    bool rb = false;  // Round bit
+    bool rb = false;                     // Round bit
     r <<= 2;
     UIntType tmp = (y << 2) + 1;
     if (r >= tmp) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/74444


More information about the libc-commits mailing list