[llvm] [ADT] Simplify IntMask (NFC) (PR #158410)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 13 00:09:58 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
We can do the shift in uintptr_t without going through intptr_t.
---
Full diff: https://github.com/llvm/llvm-project/pull/158410.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/PointerIntPair.h (+1-1)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/158410
More information about the llvm-commits
mailing list