[Mlir-commits] [mlir] [mlir][sparse] introduce `sparse_tensor.iterate` operation (PR #88955)

Aart Bik llvmlistbot at llvm.org
Wed Apr 17 14:42:43 PDT 2024


================
@@ -41,6 +45,40 @@ using Level = uint64_t;
 /// including the value `ShapedType::kDynamic` (for shapes).
 using Size = int64_t;
 
+/// A simple wrapper to encode a bitset of defined  (at most 64) levels.
+class LevelSet {
+  uint64_t bits = 0;
+
+public:
+  LevelSet() = default;
+  explicit LevelSet(uint64_t bits) : bits(bits) {}
+  operator uint64_t() const { return bits; }
+
+  LevelSet &set(unsigned i) {
+    assert(i < 64);
+    bits |= 1 << i;
----------------
aartbik wrote:

You have have to use

static_cast<uint64_t>(0x01u)  << i 

to keep all compilers and checkers happy

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


More information about the Mlir-commits mailing list