annotate lib/stdint_.h @ 6916:db0082829637

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