mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
27 lines
1.2 KiB
Diff
27 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Hall <bhallctre@gmail.com>
|
|
Date: Mon, 23 Oct 2023 21:36:40 -0400
|
|
Subject: [PATCH 32/34] Fix compilation of MathExtras.h on Windows with /sdl
|
|
|
|
See https://github.com/llvm/llvm-project/pull/68978
|
|
---
|
|
llvm/include/llvm/Support/MathExtras.h | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
|
|
index 5f034b694989d8ef24e0b249abd12a5c20146b97..03db6e4d92cb3b62ac3d8b3cbd97783817c6326b 100644
|
|
--- a/llvm/include/llvm/Support/MathExtras.h
|
|
+++ b/llvm/include/llvm/Support/MathExtras.h
|
|
@@ -356,7 +356,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"
|
|
+ uint64_t negAlign = (~Align) + 1;
|
|
+ return (Value + Align - 1) & negAlign;
|
|
}
|
|
|
|
/// If non-zero \p Skew is specified, the return value will be a minimal integer
|