summaryrefslogtreecommitdiffstats
path: root/gl/limits.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/limits.h')
-rw-r--r--gl/limits.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/gl/limits.h b/gl/limits.h
new file mode 100644
index 0000000..bf2dca2
--- /dev/null
+++ b/gl/limits.h
@@ -0,0 +1,132 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A GNU-like <limits.h>.
3
4 Copyright 2016-2021 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file 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 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#if __GNUC__ >= 3
20#pragma GCC system_header
21#endif
22
23
24#if defined _GL_ALREADY_INCLUDING_LIMITS_H
25/* Special invocation convention:
26 On Haiku/x86_64, we have a sequence of nested includes
27 <limits.h> -> <syslimits.h> -> <limits.h>.
28 In this situation, LONG_MAX and INT_MAX are not yet defined,
29 therefore we should not attempt to define LONG_BIT. */
30
31#include_next <limits.h>
32
33#else
34/* Normal invocation convention. */
35
36#ifndef _GL_LIMITS_H
37
38# define _GL_ALREADY_INCLUDING_LIMITS_H
39
40/* The include_next requires a split double-inclusion guard. */
41# include_next <limits.h>
42
43# undef _GL_ALREADY_INCLUDING_LIMITS_H
44
45#ifndef _GL_LIMITS_H
46#define _GL_LIMITS_H
47
48#ifndef LLONG_MIN
49# if defined LONG_LONG_MIN /* HP-UX 11.31 */
50# define LLONG_MIN LONG_LONG_MIN
51# elif defined LONGLONG_MIN /* IRIX 6.5 */
52# define LLONG_MIN LONGLONG_MIN
53# elif defined __GNUC__
54# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL)
55# endif
56#endif
57#ifndef LLONG_MAX
58# if defined LONG_LONG_MAX /* HP-UX 11.31 */
59# define LLONG_MAX LONG_LONG_MAX
60# elif defined LONGLONG_MAX /* IRIX 6.5 */
61# define LLONG_MAX LONGLONG_MAX
62# elif defined __GNUC__
63# define LLONG_MAX __LONG_LONG_MAX__
64# endif
65#endif
66#ifndef ULLONG_MAX
67# if defined ULONG_LONG_MAX /* HP-UX 11.31 */
68# define ULLONG_MAX ULONG_LONG_MAX
69# elif defined ULONGLONG_MAX /* IRIX 6.5 */
70# define ULLONG_MAX ULONGLONG_MAX
71# elif defined __GNUC__
72# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
73# endif
74#endif
75
76/* The number of usable bits in an unsigned or signed integer type
77 with minimum value MIN and maximum value MAX, as an int expression
78 suitable in #if. Cover all known practical hosts. This
79 implementation exploits the fact that MAX is 1 less than a power of
80 2, and merely counts the number of 1 bits in MAX; "COBn" means
81 "count the number of 1 bits in the low-order n bits"). */
82#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
83#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
84#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
85#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
86#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
87#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
88#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
89
90#ifndef WORD_BIT
91/* Assume 'int' is 32 bits wide. */
92# define WORD_BIT 32
93#endif
94#ifndef LONG_BIT
95/* Assume 'long' is 32 or 64 bits wide. */
96# if LONG_MAX == INT_MAX
97# define LONG_BIT 32
98# else
99# define LONG_BIT 64
100# endif
101#endif
102
103/* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */
104
105#if (! defined ULLONG_WIDTH \
106 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \
107 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
108# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
109# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
110# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
111# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
112# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
113# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
114# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
115# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
116# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
117# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
118# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
119#endif
120
121/* Macros specified by C2x. */
122
123#if (! defined BOOL_WIDTH \
124 && (defined _GNU_SOURCE \
125 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
126# define BOOL_MAX 1
127# define BOOL_WIDTH 1
128#endif
129
130#endif /* _GL_LIMITS_H */
131#endif /* _GL_LIMITS_H */
132#endif