[libc-commits] [libc] [libc] Add backup definition for LONG_WIDTH in limits-macros.h. (PR #79375)
via libc-commits
libc-commits at lists.llvm.org
Wed Jan 24 13:45:40 PST 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/79375
None
>From 59211749bfa713d0e3cfcb16f6b0dbda174cd83e Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Wed, 24 Jan 2024 16:44:28 -0500
Subject: [PATCH] [libc] Add backup definition for LONG_WIDTH in
limits-macros.h.
---
libc/include/llvm-libc-macros/limits-macros.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index fc21d1318a081b2..1926bc25bcfa1dc 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -69,8 +69,8 @@
#define LONG_WIDTH __LONG_WIDTH__
#elif defined(__WORDSIZE)
#define LONG_WIDTH __WORDSIZE
-#else
-#error "Unknown WORDSIZE to define LONG_WIDTH."
+#else // use sizeof(long) * CHAR_BIT as backup.
+#define LONG_WIDTH (sizeof(long) * CHAR_BIT)
#endif // __LONG_WIDTH__
#endif // LONG_WIDTH
More information about the libc-commits
mailing list