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