annotate lib/stdint_.h @ 7292:17785d5bede0

Fix docstrings
author Sergey Poznyakoff <gray@gnu.org.ua>
date Sun, 10 Sep 2006 11:52:44 +0000
parents dabe23a32d21
children 75d103bb0830
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6511
23e64dcfa86c Cosmetic tweak of SIZE_MAX.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
1 /* Copyright (C) 2001-2002, 2004-2006 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>).
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
51 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
52 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
53 <sys/types.h> after @ABSOLUTE_STDINT_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
54 #if @HAVE_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
55 # 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
56 #endif
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
57
ca3b46b1eab7 * stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6908
diff changeset
58 /* 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
59 #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
60
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
61 #if @HAVE_INTTYPES_H@
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
62 /* 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
63 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
64 <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
65 # 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
66 # include <inttypes.h>
dabe23a32d21 * lib/inttypes_.h [defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H]:
Paul Eggert <eggert@cs.ucla.edu>
parents: 7207
diff changeset
67 # 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
68 #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
69 /* 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
70 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
71 # include <sys/inttypes.h>
6722
106fa2e6b67f Fix for OpenBSD.
Bruno Haible <bruno@clisp.org>
parents: 6552
diff changeset
72 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
73
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
74 #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
75 /* 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
76 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
77 included by <sys/types.h>. */
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
78 # include <sys/bitypes.h>
0e8512b50591 Support for Linux libc4 and libc5.
Bruno Haible <bruno@clisp.org>
parents: 6459
diff changeset
79 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
80
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
81 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
82
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
83 /* Get WCHAR_MIN, WCHAR_MAX. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
84 # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
85 /* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
86 <wchar.h>. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
87 # include <stdio.h>
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
88 # include <time.h>
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
89 # include <wchar.h>
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
90 # endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
91
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
93
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
94 /* 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
95 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
96 picky compilers. */
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_MIN(signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
99 ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
100
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
101 #define _STDINT_MAX(signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
102 ((signed) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
103 ? ~ _STDINT_MIN (signed, bits, zero) \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
104 : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 /* 7.18.1.1. Exact-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
108 /* 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
109 types have 8, 16, 32, optionally 64 bits. */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
111 #undef int8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
112 #undef uint8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
113 #define int8_t signed char
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
114 #define uint8_t unsigned char
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
115
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
116 #undef int16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
117 #undef uint16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
118 #define int16_t short int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
119 #define uint16_t unsigned short int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
121 #undef int32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
122 #undef uint32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
123 #define int32_t int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
124 #define uint32_t unsigned int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
126 #undef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
127 #undef uint64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
128 #if LONG_MAX >> 31 >> 31 == 1
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
129 # define int64_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
130 # define uint64_t unsigned long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
131 #elif defined _MSC_VER
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
132 # define int64_t __int64
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
133 # define uint64_t unsigned __int64
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
134 #elif @HAVE_LONG_LONG_INT@
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
135 # define int64_t long long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
136 # define uint64_t unsigned long long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
139 /* 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
140 #define _UINT8_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
141 #define _UINT32_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
142 #define _UINT64_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
143
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 /* 7.18.1.2. Minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
147 /* 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
148 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
149 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
150
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
151 #undef int_least8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
152 #undef uint_least8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
153 #undef int_least16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
154 #undef uint_least16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
155 #undef int_least32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
156 #undef uint_least32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
157 #undef int_least64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
158 #undef uint_least64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
159 #define int_least8_t int8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
160 #define uint_least8_t uint8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
161 #define int_least16_t int16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
162 #define uint_least16_t uint16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
163 #define int_least32_t int32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
164 #define uint_least32_t uint32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
165 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
166 # define int_least64_t int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
167 # define uint_least64_t uint64_t
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 /* 7.18.1.3. Fastest minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
172 /* 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
173 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
174
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
175 /* 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
176 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
177 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
178 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
179
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
180 #undef int_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
181 #undef uint_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
182 #undef int_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
183 #undef uint_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
184 #undef int_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
185 #undef uint_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
186 #undef int_fast64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
187 #undef uint_fast64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
188 #define int_fast8_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
189 #define uint_fast8_t unsigned int_fast8_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
190 #define int_fast16_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
191 #define uint_fast16_t unsigned int_fast16_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
192 #define int_fast32_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
193 #define uint_fast32_t unsigned int_fast32_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
194 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
195 # define int_fast64_t int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
196 # define uint_fast64_t uint64_t
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 /* 7.18.1.4. Integer types capable of holding object pointers */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
201 #undef intptr_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
202 #undef uintptr_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
203 #define intptr_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
204 #define uintptr_t unsigned long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 /* 7.18.1.5. Greatest-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
208 /* 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
209 public header files. */
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
210
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
211 #undef intmax_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
212 #undef uintmax_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
213 #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
214 # define intmax_t long long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
215 # define uintmax_t unsigned long long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
216 #elif defined int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
217 # define intmax_t int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
218 # define uintmax_t uint64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
219 #else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
220 # define intmax_t long int
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
221 # define uintmax_t unsigned long int
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 /* 7.18.2. Limits of specified-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
226 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 /* 7.18.2.1. Limits of exact-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
230 /* 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
231 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
232
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
233 #undef INT8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
234 #undef INT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
235 #undef UINT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
236 #define INT8_MIN (~ INT8_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
237 #define INT8_MAX 127
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
238 #define UINT8_MAX 255
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
239
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
240 #undef INT16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
241 #undef INT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
242 #undef UINT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
243 #define INT16_MIN (~ INT16_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
244 #define INT16_MAX 32767
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
245 #define UINT16_MAX 65535
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
246
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
247 #undef INT32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
248 #undef INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
249 #undef UINT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
250 #define INT32_MIN (~ INT32_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
251 #define INT32_MAX 2147483647
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
252 #define UINT32_MAX 4294967295U
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
253
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
254 #undef INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
255 #undef INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
256 #undef UINT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
257 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
258 # define INT64_MIN (~ INT64_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
259 # define INT64_MAX INTMAX_C (9223372036854775807)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
260 # define UINT64_MAX UINTMAX_C (18446744073709551615)
5880
f403eaab7742 Simplify the #ifdefs.
Bruno Haible <bruno@clisp.org>
parents: 5879
diff changeset
261 #endif
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 /* 7.18.2.2. Limits of minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
265 /* 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
266 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
267 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
268
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
269 #undef INT_LEAST8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
270 #undef INT_LEAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
271 #undef UINT_LEAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
272 #define INT_LEAST8_MIN INT8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
273 #define INT_LEAST8_MAX INT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
274 #define UINT_LEAST8_MAX UINT8_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
275
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
276 #undef INT_LEAST16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
277 #undef INT_LEAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
278 #undef UINT_LEAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
279 #define INT_LEAST16_MIN INT16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
280 #define INT_LEAST16_MAX INT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
281 #define UINT_LEAST16_MAX UINT16_MAX
6826
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_LEAST32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
284 #undef INT_LEAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
285 #undef UINT_LEAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
286 #define INT_LEAST32_MIN INT32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
287 #define INT_LEAST32_MAX INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
288 #define UINT_LEAST32_MAX UINT32_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_LEAST64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
291 #undef INT_LEAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
292 #undef UINT_LEAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
293 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
294 # define INT_LEAST64_MIN INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
295 # define INT_LEAST64_MAX INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
296 # define UINT_LEAST64_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 /* 7.18.2.3. Limits of fastest minimum-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
301 /* 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
302 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
303 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
304
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
305 #undef INT_FAST8_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
306 #undef INT_FAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
307 #undef UINT_FAST8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
308 #define INT_FAST8_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
309 #define INT_FAST8_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
310 #define UINT_FAST8_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
311
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
312 #undef INT_FAST16_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
313 #undef INT_FAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
314 #undef UINT_FAST16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
315 #define INT_FAST16_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
316 #define INT_FAST16_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
317 #define UINT_FAST16_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
318
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
319 #undef INT_FAST32_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
320 #undef INT_FAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
321 #undef UINT_FAST32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
322 #define INT_FAST32_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
323 #define INT_FAST32_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
324 #define UINT_FAST32_MAX ULONG_MAX
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
325
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
326 #undef INT_FAST64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
327 #undef INT_FAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
328 #undef UINT_FAST64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
329 #ifdef int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
330 # define INT_FAST64_MIN INT64_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
331 # define INT_FAST64_MAX INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
332 # define UINT_FAST64_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 /* 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
336
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
337 #undef INTPTR_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
338 #undef INTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
339 #undef UINTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
340 #define INTPTR_MIN LONG_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
341 #define INTPTR_MAX LONG_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
342 #define UINTPTR_MAX ULONG_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 /* 7.18.2.5. Limits of greatest-width integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
346 #undef INTMAX_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
347 #undef INTMAX_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
348 #undef UINTMAX_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
349 #define INTMAX_MIN (~ INTMAX_MAX)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
350 #ifdef INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
351 # define INTMAX_MAX INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
352 # define UINTMAX_MAX UINT64_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 #else
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
354 # define INTMAX_MAX INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
355 # define UINTMAX_MAX UINT32_MAX
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
357
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
358 /* 7.18.3. Limits of other integer types */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
359
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
360 /* ptrdiff_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
361 #undef PTRDIFF_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
362 #undef PTRDIFF_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
363 #define PTRDIFF_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
364 _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
365 #define PTRDIFF_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
366 _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
368 /* sig_atomic_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
369 #undef SIG_ATOMIC_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
370 #undef SIG_ATOMIC_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
371 #define SIG_ATOMIC_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
372 _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
373 0@SIG_ATOMIC_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
374 #define SIG_ATOMIC_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
375 _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
376 0@SIG_ATOMIC_T_SUFFIX@)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
377
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
379 /* size_t limit */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
380 #undef SIZE_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
381 #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
382
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
383 /* wchar_t limits */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
384 #undef WCHAR_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
385 #undef WCHAR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
386 #define WCHAR_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
387 _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
388 #define WCHAR_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
389 _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
390
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
391 /* wint_t limits */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
392 #undef WINT_MIN
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
393 #undef WINT_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
394 #define WINT_MIN \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
395 _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
396 #define WINT_MAX \
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
397 _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
398
7055
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
399 #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
400
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 /* 7.18.4. Macros for integer constants */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
402
7055
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
403 #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
5bea7b615db5 Get the C++ macros/conditionals right.
Bruno Haible <bruno@clisp.org>
parents: 6916
diff changeset
404
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 /* 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
406 /* According to ISO C 99 Technical Corrigendum 1 */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
408 /* 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
409 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
410
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
411 #undef INT8_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
412 #undef UINT8_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
413 #define INT8_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
414 #define UINT8_C(x) x
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
415
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
416 #undef INT16_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
417 #undef UINT16_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
418 #define INT16_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
419 #define UINT16_C(x) x
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
420
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
421 #undef INT32_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
422 #undef UINT32_C
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
423 #define INT32_C(x) x
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
424 #define UINT32_C(x) x ## U
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
425
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
426 #undef INT64_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
427 #undef UINT64_C
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
428 #if LONG_MAX >> 31 >> 31 == 1
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
429 # define INT64_C(x) x##L
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
430 # define UINT64_C(x) x##UL
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
431 #elif defined _MSC_VER
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
432 # define INT64_C(x) x##i64
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
433 # define UINT64_C(x) x##ui64
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
434 #elif @HAVE_LONG_LONG_INT@
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
435 # define INT64_C(x) x##LL
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
436 # define UINT64_C(x) x##ULL
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
437 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
438
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
439 /* 7.18.4.2. Macros for greatest-width integer constants */
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
440
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
441 #undef INTMAX_C
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6790
diff changeset
442 #undef UINTMAX_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
443 #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
444 # define INTMAX_C(x) x##LL
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
445 # define UINTMAX_C(x) x##ULL
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
446 #elif defined int64_t
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
447 # define INTMAX_C(x) INT64_C(x)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
448 # define UINTMAX_C(x) UINT64_C(x)
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
449 #else
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
450 # define INTMAX_C(x) x##L
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
451 # define UINTMAX_C(x) x##UL
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
452 #endif
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
453
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
454 #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
455
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6872
diff changeset
456 #endif /* _GL_STDINT_H */