[PATCH] D22824: MathExtras.h: add LLVM_CONSTEXPR where simple

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 20:40:52 PDT 2016


hubert.reinterpretcast added inline comments.

================
Comment at: include/llvm/Support/MathExtras.h:672
@@ -669,2 +671,3 @@
 inline uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
+  assert(Align != 0u);
   Skew %= Align;
----------------
aaron.ballman wrote:
> Usually preferred to put in && "rationale goes here" for asserts (here and elsewhere).
> 
> Were these changes expected, as they don't seem to relate to constexpr?
Sure, I can add the "friendly text".

Also, these changes are expected. The behaviour of these functions when Align is 0 is the reason why I did not modify them so that they may be marked constexpr (according to the language).


https://reviews.llvm.org/D22824





More information about the cfe-commits mailing list