[llvm] [ADT] Simplify PointerBitMask in PointerIntPair.h (NFC) (PR #158210)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 08:02:35 PDT 2025


================
@@ -173,8 +173,7 @@ struct PointerIntPairInfo {
                 "PointerIntPair with integer size too large for pointer");
   enum MaskAndShiftConstants : uintptr_t {
     /// PointerBitMask - The bits that come from the pointer.
-    PointerBitMask =
-        ~(uintptr_t)(((intptr_t)1 << PtrTraits::NumLowBitsAvailable) - 1),
+    PointerBitMask = ((uintptr_t)-1) << PtrTraits::NumLowBitsAvailable,
----------------
kazutakahirata wrote:

We could use `std::numeric_limits<uintptr_t>::max()`, but it's quite verbose.  Let's use `~(uintptr_t(0))` if you are OK with that.

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


More information about the llvm-commits mailing list