]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/common/limits.h
WASI libc prototype implementation.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / common / limits.h
1 // Copyright (c) 2015 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #ifndef COMMON_LIMITS_H
6 #define COMMON_LIMITS_H
7
8 #include <limits.h>
9
10 #define NUMERIC_MIN(t) \
11 _Generic((t)0, char \
12 : CHAR_MIN, signed char \
13 : SCHAR_MIN, unsigned char : 0, short \
14 : SHRT_MIN, unsigned short : 0, int \
15 : INT_MIN, unsigned int : 0, long \
16 : LONG_MIN, unsigned long : 0, long long \
17 : LLONG_MIN, unsigned long long : 0, default \
18 : (void)0)
19
20 #define NUMERIC_MAX(t) \
21 _Generic((t)0, char \
22 : CHAR_MAX, signed char \
23 : SCHAR_MAX, unsigned char \
24 : UCHAR_MAX, short \
25 : SHRT_MAX, unsigned short \
26 : USHRT_MAX, int \
27 : INT_MAX, unsigned int \
28 : UINT_MAX, long \
29 : LONG_MAX, unsigned long \
30 : ULONG_MAX, long long \
31 : LLONG_MAX, unsigned long long \
32 : ULLONG_MAX, default \
33 : (void)0)
34
35 #endif