1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A GNU-like <limits.h>.
3
4 Copyright 2016-2019 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 3, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _GL_LIMITS_H
20
21#if __GNUC__ >= 3
22#pragma GCC system_header
23#endif
24
25
26/* The include_next requires a split double-inclusion guard. */
27#include_next <limits.h>
28
29#ifndef _GL_LIMITS_H
30#define _GL_LIMITS_H
31
32#ifndef LLONG_MIN
33# if defined LONG_LONG_MIN /* HP-UX 11.31 */
34# define LLONG_MIN LONG_LONG_MIN
35# elif defined LONGLONG_MIN /* IRIX 6.5 */
36# define LLONG_MIN LONGLONG_MIN
37# elif defined __GNUC__
38# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL)
39# endif
40#endif
41#ifndef LLONG_MAX
42# if defined LONG_LONG_MAX /* HP-UX 11.31 */
43# define LLONG_MAX LONG_LONG_MAX
44# elif defined LONGLONG_MAX /* IRIX 6.5 */
45# define LLONG_MAX LONGLONG_MAX
46# elif defined __GNUC__
47# define LLONG_MAX __LONG_LONG_MAX__
48# endif
49#endif
50#ifndef ULLONG_MAX
51# if defined ULONG_LONG_MAX /* HP-UX 11.31 */
52# define ULLONG_MAX ULONG_LONG_MAX
53# elif defined ULONGLONG_MAX /* IRIX 6.5 */
54# define ULLONG_MAX ULONGLONG_MAX
55# elif defined __GNUC__
56# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
57# endif
58#endif
59
60/* The number of usable bits in an unsigned or signed integer type
61 with minimum value MIN and maximum value MAX, as an int expression
62 suitable in #if. Cover all known practical hosts. This
63 implementation exploits the fact that MAX is 1 less than a power of
64 2, and merely counts the number of 1 bits in MAX; "COBn" means
65 "count the number of 1 bits in the low-order n bits"). */
66#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
67#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
68#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
69#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
70#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
71#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
72#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
73
74#ifndef WORD_BIT
75/* Assume 'int' is 32 bits wide. */
76# define WORD_BIT 32
77#endif
78#ifndef LONG_BIT
79/* Assume 'long' is 32 or 64 bits wide. */
80# if LONG_MAX == INT_MAX
81# define LONG_BIT 32
82# else
83# define LONG_BIT 64
84# endif
85#endif
86
87/* Macros specified by ISO/IEC TS 18661-1:2014. */
88
89#if (! defined ULLONG_WIDTH \
90 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
91# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
92# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
93# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
94# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
95# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
96# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
97# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
98# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
99# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
100# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
101# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
102#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
103
104#endif /* _GL_LIMITS_H */
105#endif /* _GL_LIMITS_H */
106