a1eae02ada8364b354776031a3822ae2346b7be7
[deliverable/binutils-gdb.git] / gnulib / import / limits.in.h
1 /* A GNU-like <limits.h>.
2
3 Copyright 2016 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 3, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17
18 #ifndef _@GUARD_PREFIX@_LIMITS_H
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 /* The include_next requires a split double-inclusion guard. */
26 #@INCLUDE_NEXT@ @NEXT_LIMITS_H@
27
28 #ifndef _@GUARD_PREFIX@_LIMITS_H
29 #define _@GUARD_PREFIX@_LIMITS_H
30
31 /* The number of usable bits in an unsigned or signed integer type
32 with minimum value MIN and maximum value MAX, as an int expression
33 suitable in #if. Cover all known practical hosts. This
34 implementation exploits the fact that MAX is 1 less than a power of
35 2, and merely counts the number of 1 bits in MAX; "COBn" means
36 "count the number of 1 bits in the low-order n bits"). */
37 #define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
38 #define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
39 #define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
40 #define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
41 #define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
42 #define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
43 #define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
44
45 /* Macros specified by ISO/IEC TS 18661-1:2014. */
46
47 #if (! defined ULLONG_WIDTH \
48 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
49 # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
50 # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
51 # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
52 # define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
53 # define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
54 # define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
55 # define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
56 # define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
57 # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
58 # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
59 # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
60 #endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
61
62 #endif /* _@GUARD_PREFIX@_LIMITS_H */
63 #endif /* _@GUARD_PREFIX@_LIMITS_H */
This page took 0.030502 seconds and 3 git commands to generate.