[Mlir-commits] [mlir] Fixed Windows build warnings (PR #68978)

David Blaikie llvmlistbot at llvm.org
Fri Oct 20 11:23:41 PDT 2023


================
@@ -382,7 +382,10 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align) {
 inline uint64_t alignToPowerOf2(uint64_t Value, uint64_t Align) {
   assert(Align != 0 && (Align & (Align - 1)) == 0 &&
          "Align must be a power of 2");
-  return (Value + Align - 1) & -Align;
+  // Replace unary minus to avoid compilation error on Windows:
+  // "unary minus operator applied to unsigned type, result still unsigned"
----------------
dwblaikie wrote:

Ah, fair enough - yeah. Good to keep the public headers more warning free than we might otherwise prefer internally.

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


More information about the Mlir-commits mailing list