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

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Mon Dec 4 13:42:25 PST 2023


================
@@ -152,8 +153,9 @@ class HashState {
     }
   }
   LIBC_INLINE uint64_t finish() {
-    int rot = buffer & 63;
-    uint64_t folded = folded_multiply(buffer, pad);
+    const uint64_t folded = folded_multiply(buffer, pad);
+    // Only keep the bottom bits of buffer that fits in an int.
+    const int rot = buffer & cpp::numeric_limits<int>::digits;
----------------
SchrodingerZhu wrote:

```c++
cpp::numeric_limits<int>::digits = CHAR_BIT* sizeof(int) - 1
```

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


More information about the libc-commits mailing list