Annotation of embedaddon/libiconv/srclib/limits.in.h, revision 1.1
1.1 ! misho 1: /* A GNU-like <limits.h>.
! 2:
! 3: Copyright 2016-2019 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 <https://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: #ifndef LLONG_MIN
! 32: # if defined LONG_LONG_MIN /* HP-UX 11.31 */
! 33: # define LLONG_MIN LONG_LONG_MIN
! 34: # elif defined LONGLONG_MIN /* IRIX 6.5 */
! 35: # define LLONG_MIN LONGLONG_MIN
! 36: # elif defined __GNUC__
! 37: # define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL)
! 38: # endif
! 39: #endif
! 40: #ifndef LLONG_MAX
! 41: # if defined LONG_LONG_MAX /* HP-UX 11.31 */
! 42: # define LLONG_MAX LONG_LONG_MAX
! 43: # elif defined LONGLONG_MAX /* IRIX 6.5 */
! 44: # define LLONG_MAX LONGLONG_MAX
! 45: # elif defined __GNUC__
! 46: # define LLONG_MAX __LONG_LONG_MAX__
! 47: # endif
! 48: #endif
! 49: #ifndef ULLONG_MAX
! 50: # if defined ULONG_LONG_MAX /* HP-UX 11.31 */
! 51: # define ULLONG_MAX ULONG_LONG_MAX
! 52: # elif defined ULONGLONG_MAX /* IRIX 6.5 */
! 53: # define ULLONG_MAX ULONGLONG_MAX
! 54: # elif defined __GNUC__
! 55: # define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
! 56: # endif
! 57: #endif
! 58:
! 59: /* The number of usable bits in an unsigned or signed integer type
! 60: with minimum value MIN and maximum value MAX, as an int expression
! 61: suitable in #if. Cover all known practical hosts. This
! 62: implementation exploits the fact that MAX is 1 less than a power of
! 63: 2, and merely counts the number of 1 bits in MAX; "COBn" means
! 64: "count the number of 1 bits in the low-order n bits"). */
! 65: #define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
! 66: #define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
! 67: #define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
! 68: #define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
! 69: #define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
! 70: #define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
! 71: #define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
! 72:
! 73: #ifndef WORD_BIT
! 74: /* Assume 'int' is 32 bits wide. */
! 75: # define WORD_BIT 32
! 76: #endif
! 77: #ifndef LONG_BIT
! 78: /* Assume 'long' is 32 or 64 bits wide. */
! 79: # if LONG_MAX == INT_MAX
! 80: # define LONG_BIT 32
! 81: # else
! 82: # define LONG_BIT 64
! 83: # endif
! 84: #endif
! 85:
! 86: /* Macros specified by ISO/IEC TS 18661-1:2014. */
! 87:
! 88: #if (! defined ULLONG_WIDTH \
! 89: && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
! 90: # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
! 91: # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
! 92: # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
! 93: # define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
! 94: # define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
! 95: # define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
! 96: # define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
! 97: # define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
! 98: # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
! 99: # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
! 100: # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
! 101: #endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
! 102:
! 103: #endif /* _@GUARD_PREFIX@_LIMITS_H */
! 104: #endif /* _@GUARD_PREFIX@_LIMITS_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>