[llvm] d594a00 - [ADT] Simplify IntMask (NFC) (#158410)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 13 05:37:00 PDT 2025


Author: Kazu Hirata
Date: 2025-09-13T20:36:56+08:00
New Revision: d594a009c9557698c412d2a27d36b24120d390c2

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

LOG: [ADT] Simplify IntMask (NFC) (#158410)

We can do the shift in uintptr_t without going through intptr_t.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/PointerIntPair.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h
index e48e35d476c80..75e3a58e7ca61 100644
--- a/llvm/include/llvm/ADT/PointerIntPair.h
+++ b/llvm/include/llvm/ADT/PointerIntPair.h
@@ -180,7 +180,7 @@ struct PointerIntPairInfo {
     IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable - IntBits,
 
     /// IntMask - This is the unshifted mask for valid bits of the int type.
-    IntMask = (uintptr_t)(((intptr_t)1 << IntBits) - 1),
+    IntMask = ((uintptr_t)1 << IntBits) - 1,
 
     // ShiftedIntMask - This is the bits for the integer shifted in place.
     ShiftedIntMask = (uintptr_t)(IntMask << IntShift)


        


More information about the llvm-commits mailing list