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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 23:43:28 PDT 2025


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

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


>From e0ba22227da4b942709a1dc3e0e4736c2e145ce5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 7 Oct 2025 07:19:57 -0700
Subject: [PATCH] [ADT] Modernize Bitset (NFC)

This patch modernizes BitWord and BITWORD_SIZE with "using" and
"static constexpr", respectively.
---
 llvm/include/llvm/ADT/Bitset.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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");



More information about the llvm-commits mailing list