We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36049d7 commit a2cfc6bCopy full SHA for a2cfc6b
llvm/include/llvm/Support/MathExtras.h
@@ -382,7 +382,10 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align) {
382
inline uint64_t alignToPowerOf2(uint64_t Value, uint64_t Align) {
383
assert(Align != 0 && (Align & (Align - 1)) == 0 &&
384
"Align must be a power of 2");
385
- return (Value + Align - 1) & -Align;
+ // Replace unary minus to avoid compilation error on Windows:
386
+ // "unary minus operator applied to unsigned type, result still unsigned"
387
+ uint64_t negAlign = (~Align) + 1;
388
+ return (Value + Align - 1) & negAlign;
389
}
390
391
/// If non-zero \p Skew is specified, the return value will be a minimal integer
0 commit comments