summaryrefslogtreecommitdiff
path: root/include/limits.h
diff options
context:
space:
mode:
authorRasmus Villemoes <[email protected]>2025-07-07 22:36:55 +0200
committerTom Rini <[email protected]>2025-07-14 12:43:28 -0600
commitdd260d95fd26deedc64f076b554759d09420f006 (patch)
tree7b2ec62ad2f72f200a1648b13915f94a735839b6 /include/limits.h
parent0604595c16a6bf3c0aed131b80d1a25d5d74057d (diff)
limits.h: provide all limit macros for standard [u]intNN_t types
Currently, we only have UINT32_MAX and UINT64_MAX in limits.h, and then stdint.h and kernel.h somewhat randomly define UINT8_MAX and INT32_MAX, respectively. Provide a full set of definitions in terms of the min/max macros for the types that [u]intNN_t are defined in terms of, namely the {s,u}NN ones. Try to avoid breaking whatever depended on getting UINT8_MAX from our compat stdint.h by replacing it with an include of limits.h. Signed-off-by: Rasmus Villemoes <[email protected]>
Diffstat (limited to 'include/limits.h')
-rw-r--r--include/limits.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/limits.h b/include/limits.h
index c2e3d0302b7..a032bc5b84d 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -44,9 +44,20 @@
#define S64_MAX LLONG_MAX
#define S64_MIN LLONG_MIN
+#define UINT8_MAX U8_MAX
+#define INT8_MAX S8_MAX
+#define INT8_MIN S8_MIN
+#define UINT16_MAX U16_MAX
+#define INT16_MAX S16_MAX
+#define INT16_MIN S16_MIN
+#define UINT32_MAX U32_MAX
+#define INT32_MAX S32_MAX
+#define INT32_MIN S32_MIN
+#define UINT64_MAX U64_MAX
+#define INT64_MAX S64_MAX
+#define INT64_MIN S64_MIN
+
#define CHAR_BIT 8
-#define UINT32_MAX 0xffffffffU
-#define UINT64_MAX 0xffffffffffffffffULL
#if (defined(CONFIG_64BIT) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_64BIT) && defined(CONFIG_SPL_BUILD))