[PATCH] D22445: Avoid UB in maxIntN(64).

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 17 00:03:52 PDT 2016


jlebar added inline comments.

================
Comment at: include/llvm/Support/MathExtras.h:348
@@ -347,1 +347,3 @@
+  // uint64_t to avoid UB.
+  return static_cast<uint64_t>(INT64_C(1) << (N - 1)) - 1;
 }
----------------
majnemer wrote:
> I'd just rewrite it as:
>   (UINT64_C(1)<<(N-1)) - 1
Oy.  Done, thank you.


https://reviews.llvm.org/D22445





More information about the llvm-commits mailing list