[llvm] [ADT] Simplify PointerBitMask in PointerIntPair.h (NFC) (PR #158210)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 07:13:10 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,
----------------
kuhar wrote:
I think it's more common to do `~(uintptr_t(0))` for all ones? Something like `numeric_limits` would be ideal, but I don't remember if there's a helper for all ones.
https://github.com/llvm/llvm-project/pull/158210
More information about the llvm-commits
mailing list