mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
software/include/base/limits: Fix ULONG_MAX on 64-bit
The value of ULONG_MAX should depend on the size of "long". While at it: - Add missing "UL" and "U" suffixes to large unsigned values, - Make INT_MIN and SHRT_MIN explicitly negative, - Use decimal instead of hexadecimal values, for easier comparison with /usr/include/limits.h. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
parent
e0786c3f94
commit
1710c5f1ef
1 changed files with 12 additions and 8 deletions
|
@ -5,17 +5,21 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ULONG_MAX 0xffffffff
|
#ifdef __LP64__
|
||||||
|
#define ULONG_MAX 18446744073709551615UL
|
||||||
|
#else
|
||||||
|
#define ULONG_MAX 4294967295UL
|
||||||
|
#endif
|
||||||
|
|
||||||
#define UINT_MAX 0xffffffff
|
#define UINT_MAX 4294967295U
|
||||||
#define INT_MIN 0x80000000
|
#define INT_MIN (-INT_MAX - 1)
|
||||||
#define INT_MAX 0x7fffffff
|
#define INT_MAX 2147483647
|
||||||
|
|
||||||
#define USHRT_MAX 0xffff
|
#define USHRT_MAX 65535
|
||||||
#define SHRT_MIN 0x8000
|
#define SHRT_MIN (-32768)
|
||||||
#define SHRT_MAX 0x7fff
|
#define SHRT_MAX 32767
|
||||||
|
|
||||||
#define UCHAR_MAX 0xff
|
#define UCHAR_MAX 255
|
||||||
|
|
||||||
#define CHAR_BIT 8
|
#define CHAR_BIT 8
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue