aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/include/_stdint.h
diff options
context:
space:
mode:
authorRobert Clausecker <fuz@FreeBSD.org>2025-11-19 18:53:07 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2026-01-01 20:51:52 +0000
commitff50ace5fe0ec991ff2e72a80a6c9e90b7e7f709 (patch)
tree59d76d2f18b1d38b2959cb9cec921cc0fbe0d299 /sys/x86/include/_stdint.h
parentcbad54ba46e6a4ad83d87d379fc3fcedb0cd7246 (diff)
sys/stdint.h: add C23 _WIDTH macros
The platform-dependent macros are added to the various _stdint.h headers, those that are always the same are added directly to _stdint.h. We may want to move the definitions for WCHAR_* and WINT_* out of the platform header files as those are always the same. Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53830 (cherry picked from commit 7998a82d2f99a00086baf64b2a3343ba10f8806d)
Diffstat (limited to 'sys/x86/include/_stdint.h')
-rw-r--r--sys/x86/include/_stdint.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/x86/include/_stdint.h b/sys/x86/include/_stdint.h
index 59aab4b39c0c..1b8523bf656b 100644
--- a/sys/x86/include/_stdint.h
+++ b/sys/x86/include/_stdint.h
@@ -184,6 +184,39 @@
#define WINT_MIN INT32_MIN
#define WINT_MAX INT32_MAX
+#if __ISO_C_VISIBLE >= 2023
+/*
+ * ISO/IEC 9899:2023
+ * 7.22.2 Widths of specified-width integer types
+ */
+#define INT_FAST8_WIDTH INT32_WIDTH
+#define INT_FAST16_WIDTH INT32_WIDTH
+#define INT_FAST32_WIDTH INT32_WIDTH
+#define INT_FAST64_WIDTH INT64_WIDTH
+#ifdef __LP64__
+#define INTPTR_WIDTH INT64_WIDTH
+#else
+#define INTPTR_WIDTH INT32_WIDTH
+#endif
+#define INTMAX_WIDTH INT64_WIDTH
+
+/*
+ * ISO/IEC 9899:2023
+ * 7.22.3 Width of other integer types
+ */
+#ifdef __LP64__
+#define PTRDIFF_WIDTH INT64_WIDTH
+#define SIG_ATOMIC_WIDTH INT64_WIDTH
+#define SIZE_WIDTH INT64_WIDTH
+#else
+#define PTRDIFF_WIDTH INT32_WIDTH
+#define SIG_ATOMIC_WIDTH INT32_WIDTH
+#define SIZE_WIDTH INT32_WIDTH
+#endif
+#define WCHAR_WIDTH INT32_WIDTH
+#define WINT_WIDTH INT32_WIDTH
+#endif /* __ISO_C_VISIBLE >= 2023 */
+
#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
#endif /* !_MACHINE__STDINT_H_ */