[llvm] ADT: Add constructor from uint64_t array for Bitset (PR #162703)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 17:22:48 PDT 2025


================
@@ -45,7 +45,18 @@ class Bitset {
   StorageType Bits{};
 
 protected:
-  constexpr Bitset(const StorageType &B) : Bits{B} {}
+  constexpr Bitset(const std::array<uint64_t, (NumBits + 63) / 64> &B) {
+    if (sizeof(BitWord) == sizeof(uint64_t)) {
+      for (size_t I = 0; I != B.size(); ++I)
+        Bits[I] = B[I];
+    } else {
+      for (size_t I = 0; I != B.size(); ++I) {
+        uint64_t Elt = B[I];
----------------
kuhar wrote:

Should we static assert that `sizeof(BitWord) == sizeof(uint32_t);`?

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


More information about the llvm-commits mailing list