annotate lib/stdint_.h @ 8341:7929a12676ab

New module 'vasprintf-posix'.
author Bruno Haible <bruno@clisp.org>
date Mon, 05 Mar 2007 00:37:52 +0000
parents b6376840b47b
children cd9821f8b05e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7888
b6376840b47b * modules/fnmatch (Depends-on): Depend on wchar.
Eric Blake <ebb9@byu.net>
parents: 7631
diff changeset
1 /* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 This file is part of gnulib.
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 any later version.
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 5713
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
19 #ifndef _GL_STDINT_H
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
20 #define _GL_STDINT_H
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 /*
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 * ISO C 99 <stdint.h> for platforms that lack it.
6768
296aceb85024 Shorter URL.
Bruno Haible <bruno@clisp.org>
parents: 6722
diff changeset
24 * <http://www.opengroup.org/susv3xbd/stdint.h.html>
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
27 /* Get those types that are already defined in other system include
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
28 files, so that we can "#define int8_t signed char" below without
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
29 worrying about a later system include file containing a "typedef
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
30 signed char int8_t;" that will get messed up by our macro. Our
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
31 macros should all be consistent with the system versions, except
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
32 for the "fast" types and macros, which we recommend against using
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
33 in public interfaces due to compiler differences. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
34
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
35 #if @HAVE_STDINT_H@
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
36 # if defined __sgi && ! defined __c99
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
37 /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
38 with "This header file is to be used only for c99 mode compilations"
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
39 diagnostics. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
40 # define __STDINT_H__
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
41 # endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
42 /* Other systems may have an incomplete or buggy <stdint.h>.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
43 Include it before <inttypes.h>, since any "#include <stdint.h>"
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
44 in <inttypes.h> would reinclude us, skipping our contents because
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
45 _GL_STDINT_H is defined. */
6916
db0082829637 * m4/absolute-header.m4: Renamed from full-header-path.m4.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6914
diff changeset
46 # include @ABSOLUTE_STDINT_H@
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
48
6914
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
49 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
50 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
7540
62249b8c227f b2006-10-21 Paul Eggert <eggert@cs.ucla.edu>
Paul Eggert <eggert@cs.ucla.edu>
parents: 7468
diff changeset
51 AIX 5.2 <sys/types.h> isn't needed and causes troubles.
6914
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
52 MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
53 relies on the system <stdint.h> definitions, so include
6916
db0082829637 * m4/absolute-header.m4: Renamed from full-header-path.m4.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6914
diff changeset
54 <sys/types.h> after @ABSOLUTE_STDINT_H@. */
7540
62249b8c227f b2006-10-21 Paul Eggert <eggert@cs.ucla.edu>
Paul Eggert <eggert@cs.ucla.edu>
parents: 7468
diff changeset
55 #if @HAVE_SYS_TYPES_H@ && ! defined _AIX
6914
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
56 # include <sys/types.h>
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
57 #endif
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
58
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
59 /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
60 #include <limits.h>
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
61
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
62 #if @HAVE_INTTYPES_H@
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
63 /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
6722
106fa2e6b67f Fix for OpenBSD.
Bruno Haible <bruno@clisp.org>
parents: 6552
diff changeset
64 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
65 <inttypes.h> also defines intptr_t and uintptr_t. */
7223
dabe23a32d21 * lib/inttypes_.h [defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H]:
Paul Eggert <eggert@cs.ucla.edu>
parents: 7207
diff changeset
66 # define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
dabe23a32d21 * lib/inttypes_.h [defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H]:
Paul Eggert <eggert@cs.ucla.edu>
parents: 7207
diff changeset
67 # include <inttypes.h>
dabe23a32d21 * lib/inttypes_.h [defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H]:
Paul Eggert <eggert@cs.ucla.edu>
parents: 7207
diff changeset
68 # undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
6914
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
69 #elif @HAVE_SYS_INTTYPES_H@
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
70 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
71 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
72 # include <sys/inttypes.h>
6722
106fa2e6b67f Fix for OpenBSD.
Bruno Haible <bruno@clisp.org>
parents: 6552
diff changeset
73 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
74
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
75 #if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
6510
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
76 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
77 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
78 included by <sys/types.h>. */
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
79 # include <sys/bitypes.h>
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
80 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
81
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
82 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
83
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
84 /* Get WCHAR_MIN, WCHAR_MAX. */
7888
b6376840b47b * modules/fnmatch (Depends-on): Depend on wchar.
Eric Blake <ebb9@byu.net>
parents: 7631
diff changeset
85 # if ! (defined WCHAR_MIN && defined WCHAR_MAX)
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
86 # include <wchar.h>
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
87 # endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
88
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
90
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
91 /* Minimum and maximum values for a integer type under the usual assumption.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
92 Return an unspecified value if BITS == 0, adding a check to pacify
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
93 picky compilers. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
94
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
95 #define _STDINT_MIN(signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
96 ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
97
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
98 #define _STDINT_MAX(signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
99 ((signed) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
100 ? ~ _STDINT_MIN (signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
101 : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 /* 7.18.1.1. Exact-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
105 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
106 types have 8, 16, 32, optionally 64 bits. */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
108 #undef int8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
109 #undef uint8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
110 #define int8_t signed char
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
111 #define uint8_t unsigned char
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
112
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
113 #undef int16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
114 #undef uint16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
115 #define int16_t short int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
116 #define uint16_t unsigned short int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
118 #undef int32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
119 #undef uint32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
120 #define int32_t int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
121 #define uint32_t unsigned int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
123 #undef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
124 #if LONG_MAX >> 31 >> 31 == 1
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
125 # define int64_t long int
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
126 #elif defined _MSC_VER
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
127 # define int64_t __int64
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
128 #elif @HAVE_LONG_LONG_INT@
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
129 # define int64_t long long int
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
130 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
131
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
132 #undef uint64_t
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
133 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
134 # define uint64_t unsigned long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
135 #elif defined _MSC_VER
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
136 # define uint64_t unsigned __int64
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
137 #elif @HAVE_UNSIGNED_LONG_LONG_INT@
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
138 # define uint64_t unsigned long long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
141 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
142 #define _UINT8_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
143 #define _UINT32_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
144 #define _UINT64_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
145
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 /* 7.18.1.2. Minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
149 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
150 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
151 are the same as the corresponding N_t types. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
152
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
153 #undef int_least8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
154 #undef uint_least8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
155 #undef int_least16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
156 #undef uint_least16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
157 #undef int_least32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
158 #undef uint_least32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
159 #undef int_least64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
160 #undef uint_least64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
161 #define int_least8_t int8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
162 #define uint_least8_t uint8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
163 #define int_least16_t int16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
164 #define uint_least16_t uint16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
165 #define int_least32_t int32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
166 #define uint_least32_t uint32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
167 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
168 # define int_least64_t int64_t
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
169 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
170 #ifdef uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
171 # define uint_least64_t uint64_t
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 /* 7.18.1.3. Fastest minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
176 /* Note: Other <stdint.h> substitutes may define these types differently.
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
177 It is not recommended to use these types in public header files. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
178
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
179 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
180 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
181 are taken from the same list of types. Assume that 'long int'
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
182 is fast enough for all narrower integers. */
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
183
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
184 #undef int_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
185 #undef uint_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
186 #undef int_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
187 #undef uint_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
188 #undef int_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
189 #undef uint_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
190 #undef int_fast64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
191 #undef uint_fast64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
192 #define int_fast8_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
193 #define uint_fast8_t unsigned int_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
194 #define int_fast16_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
195 #define uint_fast16_t unsigned int_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
196 #define int_fast32_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
197 #define uint_fast32_t unsigned int_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
198 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
199 # define int_fast64_t int64_t
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
200 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
201 #ifdef uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
202 # define uint_fast64_t uint64_t
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 /* 7.18.1.4. Integer types capable of holding object pointers */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
207 #undef intptr_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
208 #undef uintptr_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
209 #define intptr_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
210 #define uintptr_t unsigned long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 /* 7.18.1.5. Greatest-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
214 /* Note: These types are compiler dependent. It may be unwise to use them in
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
215 public header files. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
216
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
217 #undef intmax_t
6908
e01e090171d5 * stdint_.h (intmax_t, uintmax_t): Prefer long to long long if
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
218 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
219 # define intmax_t long long int
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
220 #elif defined int64_t
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
221 # define intmax_t int64_t
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
222 #else
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
223 # define intmax_t long int
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
224 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
225
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
226 #undef uintmax_t
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
227 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
228 # define uintmax_t unsigned long long int
7631
dea67355b192 * lib/stdint_.h (uintmax_t): Fix typo: int64_t -> uint64_t.
Paul Eggert <eggert@cs.ucla.edu>
parents: 7540
diff changeset
229 #elif defined uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
230 # define uintmax_t uint64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
231 #else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
232 # define uintmax_t unsigned long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 /* 7.18.2. Limits of specified-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
237 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
239 /* 7.18.2.1. Limits of exact-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
241 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
242 types have 8, 16, 32, optionally 64 bits. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
243
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
244 #undef INT8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
245 #undef INT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
246 #undef UINT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
247 #define INT8_MIN (~ INT8_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
248 #define INT8_MAX 127
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
249 #define UINT8_MAX 255
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
250
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
251 #undef INT16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
252 #undef INT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
253 #undef UINT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
254 #define INT16_MIN (~ INT16_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
255 #define INT16_MAX 32767
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
256 #define UINT16_MAX 65535
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
257
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
258 #undef INT32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
259 #undef INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
260 #undef UINT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
261 #define INT32_MIN (~ INT32_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
262 #define INT32_MAX 2147483647
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
263 #define UINT32_MAX 4294967295U
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
264
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
265 #undef INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
266 #undef INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
267 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
268 # define INT64_MIN (~ INT64_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
269 # define INT64_MAX INTMAX_C (9223372036854775807)
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
270 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
271
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
272 #undef UINT64_MAX
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
273 #ifdef uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
274 # define UINT64_MAX UINTMAX_C (18446744073709551615)
5880
f403eaab7742 Simplify the #ifdefs.
Bruno Haible <bruno@clisp.org>
parents: 5879
diff changeset
275 #endif
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 /* 7.18.2.2. Limits of minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
279 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
280 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
281 are the same as the corresponding N_t types. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
282
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
283 #undef INT_LEAST8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
284 #undef INT_LEAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
285 #undef UINT_LEAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
286 #define INT_LEAST8_MIN INT8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
287 #define INT_LEAST8_MAX INT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
288 #define UINT_LEAST8_MAX UINT8_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
289
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
290 #undef INT_LEAST16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
291 #undef INT_LEAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
292 #undef UINT_LEAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
293 #define INT_LEAST16_MIN INT16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
294 #define INT_LEAST16_MAX INT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
295 #define UINT_LEAST16_MAX UINT16_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
296
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
297 #undef INT_LEAST32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
298 #undef INT_LEAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
299 #undef UINT_LEAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
300 #define INT_LEAST32_MIN INT32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
301 #define INT_LEAST32_MAX INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
302 #define UINT_LEAST32_MAX UINT32_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
303
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
304 #undef INT_LEAST64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
305 #undef INT_LEAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
306 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
307 # define INT_LEAST64_MIN INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
308 # define INT_LEAST64_MAX INT64_MAX
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
309 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
310
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
311 #undef UINT_LEAST64_MAX
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
312 #ifdef uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
313 # define UINT_LEAST64_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 /* 7.18.2.3. Limits of fastest minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
318 /* Here we assume a standard architecture where the hardware integer
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
319 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
320 are taken from the same list of types. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
321
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
322 #undef INT_FAST8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
323 #undef INT_FAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
324 #undef UINT_FAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
325 #define INT_FAST8_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
326 #define INT_FAST8_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
327 #define UINT_FAST8_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
328
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
329 #undef INT_FAST16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
330 #undef INT_FAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
331 #undef UINT_FAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
332 #define INT_FAST16_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
333 #define INT_FAST16_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
334 #define UINT_FAST16_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
335
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
336 #undef INT_FAST32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
337 #undef INT_FAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
338 #undef UINT_FAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
339 #define INT_FAST32_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
340 #define INT_FAST32_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
341 #define UINT_FAST32_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
342
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
343 #undef INT_FAST64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
344 #undef INT_FAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
345 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
346 # define INT_FAST64_MIN INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
347 # define INT_FAST64_MAX INT64_MAX
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
348 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
349
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
350 #undef UINT_FAST64_MAX
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
351 #ifdef uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
352 # define UINT_FAST64_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
355 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
357 #undef INTPTR_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
358 #undef INTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
359 #undef UINTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
360 #define INTPTR_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
361 #define INTPTR_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
362 #define UINTPTR_MAX ULONG_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 /* 7.18.2.5. Limits of greatest-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
366 #undef INTMAX_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
367 #undef INTMAX_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
368 #define INTMAX_MIN (~ INTMAX_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
369 #ifdef INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
370 # define INTMAX_MAX INT64_MAX
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
371 #else
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
372 # define INTMAX_MAX INT32_MAX
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
373 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
374
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
375 #undef UINTMAX_MAX
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
376 #ifdef UINT64_MAX
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
377 # define UINTMAX_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 #else
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
379 # define UINTMAX_MAX UINT32_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 /* 7.18.3. Limits of other integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
384 /* ptrdiff_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
385 #undef PTRDIFF_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
386 #undef PTRDIFF_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
387 #define PTRDIFF_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
388 _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
389 #define PTRDIFF_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
390 _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
392 /* sig_atomic_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
393 #undef SIG_ATOMIC_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
394 #undef SIG_ATOMIC_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
395 #define SIG_ATOMIC_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
396 _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
397 0@SIG_ATOMIC_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
398 #define SIG_ATOMIC_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
399 _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
400 0@SIG_ATOMIC_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
401
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
402
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
403 /* size_t limit */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
404 #undef SIZE_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
405 #define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
407 /* wchar_t limits */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
408 #undef WCHAR_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
409 #undef WCHAR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
410 #define WCHAR_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
411 _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
412 #define WCHAR_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
413 _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
414
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
415 /* wint_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
416 #undef WINT_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
417 #undef WINT_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
418 #define WINT_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
419 _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
420 #define WINT_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
421 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
422
7055
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
423 #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
424
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
425 /* 7.18.4. Macros for integer constants */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
426
7055
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
427 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
428
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
429 /* 7.18.4.1. Macros for minimum-width integer constants */
6861
b82bca6af622 Take into account ISO C 99 TC1.
Bruno Haible <bruno@clisp.org>
parents: 6836
diff changeset
430 /* According to ISO C 99 Technical Corrigendum 1 */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
431
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
432 /* Here we assume a standard architecture where the hardware integer
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
433 types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
434
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
435 #undef INT8_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
436 #undef UINT8_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
437 #define INT8_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
438 #define UINT8_C(x) x
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
439
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
440 #undef INT16_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
441 #undef UINT16_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
442 #define INT16_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
443 #define UINT16_C(x) x
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
444
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
445 #undef INT32_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
446 #undef UINT32_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
447 #define INT32_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
448 #define UINT32_C(x) x ## U
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
449
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
450 #undef INT64_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
451 #undef UINT64_C
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
452 #if LONG_MAX >> 31 >> 31 == 1
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
453 # define INT64_C(x) x##L
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
454 #elif defined _MSC_VER
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
455 # define INT64_C(x) x##i64
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
456 #elif @HAVE_LONG_LONG_INT@
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
457 # define INT64_C(x) x##LL
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
458 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
459 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
460 # define UINT64_C(x) x##UL
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
461 #elif defined _MSC_VER
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
462 # define UINT64_C(x) x##ui64
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
463 #elif @HAVE_UNSIGNED_LONG_LONG_INT@
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
464 # define UINT64_C(x) x##ULL
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
465 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
466
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
467 /* 7.18.4.2. Macros for greatest-width integer constants */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
468
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
469 #undef INTMAX_C
6908
e01e090171d5 * stdint_.h (intmax_t, uintmax_t): Prefer long to long long if
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
470 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
471 # define INTMAX_C(x) x##LL
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
472 #elif defined int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
473 # define INTMAX_C(x) INT64_C(x)
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
474 #else
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
475 # define INTMAX_C(x) x##L
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
476 #endif
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
477
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
478 #undef UINTMAX_C
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
479 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
480 # define UINTMAX_C(x) x##ULL
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
481 #elif defined uint64_t
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
482 # define UINTMAX_C(x) UINT64_C(x)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
483 #else
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
484 # define UINTMAX_C(x) x##UL
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
486
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
487 #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
488
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
489 #endif /* _GL_STDINT_H */