Skip to content

Commit 8c3bd8b

Browse files
committed
tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong
They are useful for users and necessary for strtol() and friends. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 774e6ef commit 8c3bd8b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tools/include/nolibc/stdint.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ typedef uint64_t uintmax_t;
9696
#define UINT_FAST32_MAX SIZE_MAX
9797
#define UINT_FAST64_MAX UINT64_MAX
9898

99+
#define INTMAX_MIN INT64_MIN
100+
#define INTMAX_MAX INT64_MAX
101+
#define UINTMAX_MAX UINT64_MAX
102+
99103
#ifndef INT_MIN
100104
#define INT_MIN (-__INT_MAX__ - 1)
101105
#endif
@@ -110,4 +114,19 @@ typedef uint64_t uintmax_t;
110114
#define LONG_MAX __LONG_MAX__
111115
#endif
112116

117+
#ifndef ULONG_MAX
118+
#define ULONG_MAX ((unsigned long)(__LONG_MAX__) * 2 + 1)
119+
#endif
120+
121+
#ifndef LLONG_MIN
122+
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
123+
#endif
124+
#ifndef LLONG_MAX
125+
#define LLONG_MAX __LONG_LONG_MAX__
126+
#endif
127+
128+
#ifndef ULLONG_MAX
129+
#define ULLONG_MAX ((unsigned long long)(__LONG_LONG_MAX__) * 2 + 1)
130+
#endif
131+
113132
#endif /* _NOLIBC_STDINT_H */

0 commit comments

Comments
 (0)