[llvm] [ADT] Refactor Bitset to Be More Constexpr-Usable and Add More Member Functions (PR #172062)

Jiachen Yuan via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 15 18:06:51 PST 2025


================
@@ -41,6 +45,11 @@ class Bitset {
   using StorageType = std::array<BitWord, NumWords>;
   StorageType Bits{};
 
+  constexpr void maskLastWord() {
+    if constexpr (RemainderNumBits != 0)
----------------
JiachenYuan wrote:

This is just so that the `maskLastWord()` becomes a no-op when `RemainderNumBits` is 0, but I guess masking with -1 will probably also be optimized away by the host compiler. We can remove the `if-constexpr`.

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


More information about the llvm-commits mailing list