Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b9d70dd60270fe94e015cb89270132650c75b33e.1684932861.git.Jens.Gustedt@inria.fr>
Date: Fri, 21 Apr 2023 13:33:32 +0200
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [C23 divers headers 01/17] C23: add the WIDTH macros for the
 standard integer types

These have not previously reserved, nevertheless we define them
without feature macro. This is because these are now the fundamental
definitions for standard integer types, basically all other features
of standard integer types can now be derived from them. We could later
add a cleanup patch, that would exactly do that: provide the width of
all integer types and then derive MIN and MAX macros systematically
from that.
---
 include/limits.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/limits.h b/include/limits.h
index 53a27b9d..476f4891 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -5,6 +5,24 @@
 
 #include <bits/alltypes.h> /* __LONG_MAX */
 
+#define BOOL_WIDTH 1
+#define CHAR_WIDTH 8
+#define UCHAR_WIDTH 8
+#define SCHAR_WIDTH 8
+#define USHRT_WIDTH 16
+#define SHRT_WIDTH 16
+#define UINT_WIDTH 32
+#define INT_WIDTH 32
+#define ULLONG_WIDTH 64
+#define LLONG_WIDTH 64
+#if __LONG_MAX == 0x7fffffff
+#define ULONG_WIDTH 32
+#define LONG_WIDTH 32
+#else
+#define ULONG_WIDTH 64
+#define LONG_WIDTH 64
+#endif
+
 /* Support signed or unsigned plain-char */
 
 #if '\xff' > 0
-- 
2.34.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.