diff options
| author | Rasmus Villemoes <ravi@prevas.dk> | 2025-07-07 22:36:54 +0200 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-07-14 12:43:28 -0600 |
| commit | 0604595c16a6bf3c0aed131b80d1a25d5d74057d (patch) | |
| tree | bda8fdd379f4ba97aa7d3d96ff0f11cbf3e86cf7 /include/limits.h | |
| parent | dc323f3bee318514af9d7c6fed1e01c712bc71ae (diff) | |
move limits for sNN/uNN types from kernel.h to limits.h
Since we define the {s,u}{8,16,32,64} types the same way on all
architectures, i.e. everybody uses asm-generic/int-ll64.h, we can just
define the associated limit macros in terms of those for the
corresponding types. This eliminates another set of limit macros that
are not usable in #if conditionals.
These type names and macros are not C or POSIX, so there's no language
violation, but certainly a violation of developers' reasonable
expectations.
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Diffstat (limited to 'include/limits.h')
| -rw-r--r-- | include/limits.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/limits.h b/include/limits.h index 4dcfbe9b156..c2e3d0302b7 100644 --- a/include/limits.h +++ b/include/limits.h @@ -31,6 +31,19 @@ #define LLONG_MIN (-LLONG_MAX - 1LL) #define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +#define U8_MAX UCHAR_MAX +#define S8_MAX SCHAR_MAX +#define S8_MIN SCHAR_MIN +#define U16_MAX USHRT_MAX +#define S16_MAX SHRT_MAX +#define S16_MIN SHRT_MIN +#define U32_MAX UINT_MAX +#define S32_MAX INT_MAX +#define S32_MIN INT_MIN +#define U64_MAX ULLONG_MAX +#define S64_MAX LLONG_MAX +#define S64_MIN LLONG_MIN + #define CHAR_BIT 8 #define UINT32_MAX 0xffffffffU #define UINT64_MAX 0xffffffffffffffffULL |
