[Mlir-commits] [mlir] c175157 - [mlir][sparse] fix windows build issue with hex literals (#80770)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Feb 5 16:48:18 PST 2024


Author: Aart Bik
Date: 2024-02-05T16:48:14-08:00
New Revision: c175157dc158d1e4ebdf60c6af75a5106c474780

URL: https://github.com/llvm/llvm-project/commit/c175157dc158d1e4ebdf60c6af75a5106c474780
DIFF: https://github.com/llvm/llvm-project/commit/c175157dc158d1e4ebdf60c6af75a5106c474780.diff

LOG: [mlir][sparse] fix windows build issue with hex literals (#80770)

Fixes:
https://github.com/llvm/llvm-project/issues/73828

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
index 1f662e20423048..86c52bfc651ef1 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
@@ -530,27 +530,27 @@ static_assert((isUniqueLT(LevelType::Dense) &&
 ///
 constexpr uint64_t encodeDim(uint64_t i, uint64_t cf, uint64_t cm) {
   if (cf != 0) {
-    assert(cf <= 0xfffff && cm == 0 && i <= 0xfffff);
-    return (0x01ULL << 60) | (cf << 20) | i;
+    assert(cf <= 0xfffffu && cm == 0 && i <= 0xfffffu);
+    return (static_cast<uint64_t>(0x01u) << 60) | (cf << 20) | i;
   }
   if (cm != 0) {
-    assert(cm <= 0xfffff && i <= 0xfffff);
-    return (0x02ULL << 60) | (cm << 20) | i;
+    assert(cm <= 0xfffffu && i <= 0xfffffu);
+    return (static_cast<uint64_t>(0x02u) << 60) | (cm << 20) | i;
   }
   assert(i <= 0x0fffffffffffffffu);
   return i;
 }
 constexpr uint64_t encodeLvl(uint64_t i, uint64_t c, uint64_t ii) {
   if (c != 0) {
-    assert(c <= 0xfffff && ii <= 0xfffff && i <= 0xfffff);
-    return (0x03ULL << 60) | (c << 20) | (ii << 40) | i;
+    assert(c <= 0xfffffu && ii <= 0xfffffu && i <= 0xfffffu);
+    return (static_cast<uint64_t>(0x03u) << 60) | (c << 20) | (ii << 40) | i;
   }
   assert(i <= 0x0fffffffffffffffu);
   return i;
 }
-constexpr bool isEncodedFloor(uint64_t v) { return (v >> 60) == 0x01; }
-constexpr bool isEncodedMod(uint64_t v) { return (v >> 60) == 0x02; }
-constexpr bool isEncodedMul(uint64_t v) { return (v >> 60) == 0x03; }
+constexpr bool isEncodedFloor(uint64_t v) { return (v >> 60) == 0x01u; }
+constexpr bool isEncodedMod(uint64_t v) { return (v >> 60) == 0x02u; }
+constexpr bool isEncodedMul(uint64_t v) { return (v >> 60) == 0x03u; }
 constexpr uint64_t decodeIndex(uint64_t v) { return v & 0xfffffu; }
 constexpr uint64_t decodeConst(uint64_t v) { return (v >> 20) & 0xfffffu; }
 constexpr uint64_t decodeMulc(uint64_t v) { return (v >> 20) & 0xfffffu; }


        


More information about the Mlir-commits mailing list