[llvm] [ADT] Modernize Bitset (NFC) (PR #162430)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 23:44:01 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

This patch modernizes BitWord and BITWORD_SIZE with "using" and
"static constexpr", respectively.


---
Full diff: https://github.com/llvm/llvm-project/pull/162430.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/Bitset.h (+2-2) 


``````````diff
diff --git a/llvm/include/llvm/ADT/Bitset.h b/llvm/include/llvm/ADT/Bitset.h
index ecb6b149f0494..d9f750ff55185 100644
--- a/llvm/include/llvm/ADT/Bitset.h
+++ b/llvm/include/llvm/ADT/Bitset.h
@@ -28,9 +28,9 @@ namespace llvm {
 /// initialization.
 template <unsigned NumBits>
 class Bitset {
-  typedef uintptr_t BitWord;
+  using BitWord = uintptr_t;
 
-  enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
+  static constexpr unsigned BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT;
 
   static_assert(BITWORD_SIZE == 64 || BITWORD_SIZE == 32,
                 "Unsupported word size");

``````````

</details>


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


More information about the llvm-commits mailing list