Skip to content

Commit 10c98f3

Browse files
committed
options/ansi: fix LONG_BIT definition
1 parent 8bdb7a6 commit 10c98f3

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

options/ansi/include/limits.h

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,6 @@
77
# define MB_LEN_MAX 4
88
#endif
99

10-
#ifdef LONG_MAX
11-
# ifdef LONG_MAX == INT32_MAX
12-
# define LONG_BIT 32
13-
# else
14-
/* Safe assumption */
15-
# define LONG_BIT 64
16-
# endif
17-
#elif defined __LONG_MAX__
18-
# if __LONG_MAX__ == INT32_MAX
19-
# define LONG_BIT 32
20-
# else
21-
/* Safe assumption */
22-
# define LONG_BIT 64
23-
# endif
24-
#else
25-
# error "Unsupported configuration, please define either LONG_MAX or __LONG_MAX__"
26-
#endif
27-
2810
#undef SCHAR_MIN
2911
#undef SCHAR_MAX
3012
#undef CHAR_MIN
@@ -99,12 +81,19 @@
9981
/* POSIX states 9 is the minimum for NL_ARGMAX */
10082
#define NL_ARGMAX 9
10183

102-
#if INTPTR_MAX == INT64_MAX
84+
#if __INTPTR_MAX__ == __INT64_MAX__
10385
# define SSIZE_MAX LONG_MAX
104-
#elif INTPTR_MAX == INT32_MAX
86+
#elif __INTPTR_MAX__ == __INT32_MAX__
10587
# define SSIZE_MAX INT_MAX
10688
#endif
10789

90+
#if __LONG_MAX__ == __INT32_MAX__
91+
# define LONG_BIT 32
92+
#else
93+
/* Safe assumption */
94+
# define LONG_BIT 64
95+
#endif
96+
10897
#define _POSIX_ARG_MAX 4096
10998
#define _POSIX_OPEN_MAX 16
11099
#define _POSIX_HOST_NAME_MAX 255

0 commit comments

Comments
 (0)