[libc-commits] [libc] [libc] Fix definition of `UINT_MAX` in limits.h (PR #95279)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Jun 12 10:57:53 PDT 2024


================
@@ -148,7 +148,7 @@
 #endif // INT_MAX
 
 #ifndef UINT_MAX
-#define UINT_MAX (~0U)
+#define UINT_MAX (INT_MAX * 2U + 1U)
----------------
jhuber6 wrote:

Should be handled by the `2U` part, otherwise it would fail in the myriad templates we use in `limits.h` I believe.

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


More information about the libc-commits mailing list