Add <stdint.h> integer width macros
diff mbox

Message ID alpine.DEB.2.20.1609202019450.13558@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Sept. 20, 2016, 8:21 p.m. UTC
TS 18661-1 defines macros for the width of integer types, intended for
use with the fromfp functions to convert from floating-point types to
integer types of any width, in any rounding mode and with control over
whether "inexact" is raised.  Such macros are, of course, more
generally useful than just with those functions.

Those macros are added to <limits.h> and <stdint.h>.  Having
previously added the <limits.h> macros, this patch adds the <stdint.h>
ones.  I've also added these macros to GCC's headers for GCC 7, but
for glibc systems, the definitions in GCC's <stdint.h> will only be
used with -ffreestanding.

Tested for x86_64 and x86.

2016-09-20  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/generic/stdint.h: Define
	__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
	<bits/libc-header-start.h> instead of including <features.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT8_WIDTH): New macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_LEAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_LEAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST8_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST16_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST32_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INT_FAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINT_FAST64_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTPTR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTPTR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (INTMAX_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (UINTMAX_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (PTRDIFF_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIG_ATOMIC_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (SIZE_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (WCHAR_WIDTH): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (WINT_WIDTH): Likewise.
	* manual/arith.texi (Integers): Document these macros for types
	specified by width properties.
	* manual/lang.texi (Width of Type): Document these macros for
	other standard typedefs.
	* stdlib/tst-width-stdint.c: New file.
	* stdlib/Makefile (tests): Add tst-width-stdint.

Comments

Paul Eggert Sept. 20, 2016, 8:43 p.m. UTC | #1
On 09/20/2016 01:21 PM, Joseph Myers wrote:
> +# define WCHAR_WIDTH 32

When compiling with 'gcc -fshort-wchar' this should be 16, to be 
consistent with WCHAR_MAX.
Joseph Myers Sept. 20, 2016, 8:52 p.m. UTC | #2
On Tue, 20 Sep 2016, Paul Eggert wrote:

> On 09/20/2016 01:21 PM, Joseph Myers wrote:
> > +# define WCHAR_WIDTH 32
> 
> When compiling with 'gcc -fshort-wchar' this should be 16, to be consistent
> with WCHAR_MAX.

Compiling with -fshort-wchar is not compatible with using glibc; it's an 
ABI-breaking option.  (On ARM you'll get a link error if you try because 
of the EABI object attributes.)

The special handling of WCHAR_MIN and WCHAR_MAX is because (a) they go in 
wchar.h as well as in stdint.h (they first appeared in C90 Amendment 1, 
which didn't have stdint.h) and (b) the underlying type may vary between 
architectures in a way that doesn't just depend on word size, which 
complicates things if using a compiler without the relevant predefines.  
It's not about -fshort-wchar, and the fallback definitions in bits/wchar.h 
for compilers without such predefines make no atttempt to handle 
-fshort-wchar.
Paul Eggert Sept. 20, 2016, 9:49 p.m. UTC | #3
On 09/20/2016 01:52 PM, Joseph Myers wrote:
> Compiling with -fshort-wchar is not compatible with using glibc; it's an
> ABI-breaking option.

That's OK, as stdint.h is also for freestanding programs, where there's 
no wchar_t ABI to break.

> the fallback definitions in bits/wchar.h
> for compilers without such predefines make no atttempt to handle
> -fshort-wchar.
That's OK too, as it means glibc's WCHAR_MAX supports compilers that 
either #define __WCHAR_MAX__ or have a 32-bit wchar_t. glibc's 
WCHAR_WIDTH can do the same. Surely it would be unsporting for 
WCHAR_WIDTH to disagree with WCHAR_MAX.
Joseph Myers Sept. 20, 2016, 9:53 p.m. UTC | #4
On Tue, 20 Sep 2016, Paul Eggert wrote:

> On 09/20/2016 01:52 PM, Joseph Myers wrote:
> > Compiling with -fshort-wchar is not compatible with using glibc; it's an
> > ABI-breaking option.
> 
> That's OK, as stdint.h is also for freestanding programs, where there's no
> wchar_t ABI to break.

But glibc's stdint.h isn't for freestanding programs.  GCC uses its own 
stdint.h for -ffreestanding.
Paul Eggert Sept. 20, 2016, 10:41 p.m. UTC | #5
On 09/20/2016 02:53 PM, Joseph Myers wrote:
> glibc's stdint.h isn't for freestanding programs.

Ah, sorry, I didn't know. That removes the main point of my objection then.
Florian Weimer Sept. 21, 2016, 3:19 p.m. UTC | #6
On 09/20/2016 10:21 PM, Joseph Myers wrote:
> TS 18661-1 defines macros for the width of integer types, intended for
> use with the fromfp functions to convert from floating-point types to
> integer types of any width, in any rounding mode and with control over
> whether "inexact" is raised.  Such macros are, of course, more
> generally useful than just with those functions.

Looks good to me, although I don't have access to TS 18661-1 (I think).

I'm still surprised there isn't anything for _Bool, and as you've told 
me, that's one type where there is actual variance (besides wchar_t).

Thanks,
Florian
Joseph Myers Sept. 21, 2016, 4:28 p.m. UTC | #7
On Wed, 21 Sep 2016, Florian Weimer wrote:

> I'm still surprised there isn't anything for _Bool, and as you've told me,
> that's one type where there is actual variance (besides wchar_t).

If _Bool has a width greater than 1, there's still no way of getting a 
value other than 0 or 1 into an object of type _Bool other than memcpy 
knowing about the representation.  So knowing _Bool's width isn't that 
useful (though a width greater than 1 means you can declare _Bool 
bit-fields with a width greater than 1, which similarly isn't useful).  
The fact that a width greater than 1 is possible for _Bool at all is an 
obscure corner of the language.

It's clearly expected that when you use one of these macros with one of 
the fromfp functions, you then convert the (intmax_t or uintmax_t) result 
to the corresponding type, and conversions to _Bool act differently from 
conversions to normal integer types.

Patch
diff mbox

diff --git a/NEWS b/NEWS
index 0ea6bfa..51215d8 100644
--- a/NEWS
+++ b/NEWS
@@ -38,7 +38,16 @@  Version 2.25
 
 * Integer width macros from TS 18661-1:2014 are added to <limits.h>:
   CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH,
-  UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH.
+  UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH; and to
+  <stdint.h>: INT8_WIDTH, UINT8_WIDTH, INT16_WIDTH, UINT16_WIDTH,
+  INT32_WIDTH, UINT32_WIDTH, INT64_WIDTH, UINT64_WIDTH, INT_LEAST8_WIDTH,
+  UINT_LEAST8_WIDTH, INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH,
+  INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH, INT_LEAST64_WIDTH,
+  UINT_LEAST64_WIDTH, INT_FAST8_WIDTH, UINT_FAST8_WIDTH, INT_FAST16_WIDTH,
+  UINT_FAST16_WIDTH, INT_FAST32_WIDTH, UINT_FAST32_WIDTH, INT_FAST64_WIDTH,
+  UINT_FAST64_WIDTH, INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH,
+  UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH,
+  WINT_WIDTH.
 
 * The <sys/quota.h> header now includes the <linux/quota.h> header.  Support
   for the Linux quota interface which predates kernel version 2.4.22 has
diff --git a/manual/arith.texi b/manual/arith.texi
index 23b9373..dc3c367 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -110,7 +110,9 @@  minimum possible values for each integer data type.  The macro names
 follow these examples: @code{INT32_MAX}, @code{UINT8_MAX},
 @code{INT_FAST32_MIN}, @code{INT_LEAST64_MIN}, @code{UINTMAX_MAX},
 @code{INTMAX_MAX}, @code{INTMAX_MIN}.  Note that there are no macros for
-unsigned integer minima.  These are always zero.
+unsigned integer minima.  These are always zero.  Similiarly, there
+are macros such as @code{INTMAX_WIDTH} for the width of these types.
+Those macros for integer type widths come from TS 18661-1:2014.
 @cindex maximum possible integer
 @cindex minimum possible integer
 
diff --git a/manual/lang.texi b/manual/lang.texi
index 3705df0..ae7d5be 100644
--- a/manual/lang.texi
+++ b/manual/lang.texi
@@ -703,6 +703,38 @@  int}, @code{long long int} and @code{unsigned long long int},
 respectively.
 @end table
 
+Further such macros are defined in @file{stdint.h}.  Apart from those
+for types specified by width (@pxref{Integers}), the following are
+defined.
+
+@table @code
+@comment stdint.h
+@comment ISO
+@item INTPTR_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx UINTPTR_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx PTRDIFF_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx SIG_ATOMIC_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx SIZE_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx WCHAR_WIDTH
+@comment stdint.h
+@comment ISO
+@itemx WINT_WIDTH
+
+These are the widths of the types @code{intptr_t}, @code{uintptr_t},
+@code{ptrdiff_t}, @code{sig_atomic_t}, @code{size_t}, @code{wchar_t}
+and @code{wint_t}, respectively.
+@end table
+
 @node Range of Type
 @subsection Range of an Integer Type
 @cindex integer type range
diff --git a/stdlib/Makefile b/stdlib/Makefile
index ccc9aae..de3ecbb 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -77,7 +77,8 @@  tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   tst-tininess tst-strtod-underflow tst-tls-atexit	    \
 		   tst-setcontext3 tst-tls-atexit-nodelete		    \
 		   tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l    \
-		   tst-quick_exit tst-thread-quick_exit tst-width
+		   tst-quick_exit tst-thread-quick_exit tst-width	    \
+		   tst-width-stdint
 tests-static	:= tst-secure-getenv
 ifeq ($(have-cxx-thread_local),yes)
 CFLAGS-tst-quick_exit.o = -std=c++11
diff --git a/stdlib/tst-width-stdint.c b/stdlib/tst-width-stdint.c
new file mode 100644
index 0000000..29b8b93
--- /dev/null
+++ b/stdlib/tst-width-stdint.c
@@ -0,0 +1,185 @@ 
+/* Test integer width macros in <stdint.h>.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#define CHECK_WIDTH(TYPE, MAX, WIDTH)					\
+  do									\
+    {									\
+      if ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) != 1)	\
+	{								\
+	  puts ("bad width of " #TYPE);					\
+	  result = 1;							\
+	}								\
+      else								\
+	puts ("width of " #TYPE " OK");					\
+    }									\
+  while (0)
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+#ifndef INT8_WIDTH
+# error "missing INT8_WIDTH"
+#endif
+  CHECK_WIDTH (int8_t, INT8_MAX, INT8_WIDTH);
+#ifndef INT16_WIDTH
+# error "missing INT16_WIDTH"
+#endif
+  CHECK_WIDTH (int16_t, INT16_MAX, INT16_WIDTH);
+#ifndef INT32_WIDTH
+# error "missing INT32_WIDTH"
+#endif
+  CHECK_WIDTH (int32_t, INT32_MAX, INT32_WIDTH);
+#ifndef INT64_WIDTH
+# error "missing INT64_WIDTH"
+#endif
+  CHECK_WIDTH (int64_t, INT64_MAX, INT64_WIDTH);
+#ifndef UINT8_WIDTH
+# error "missing UINT8_WIDTH"
+#endif
+  CHECK_WIDTH (uint8_t, UINT8_MAX, UINT8_WIDTH);
+#ifndef UINT16_WIDTH
+# error "missing UINT16_WIDTH"
+#endif
+  CHECK_WIDTH (uint16_t, UINT16_MAX, UINT16_WIDTH);
+#ifndef UINT32_WIDTH
+# error "missing UINT32_WIDTH"
+#endif
+  CHECK_WIDTH (uint32_t, UINT32_MAX, UINT32_WIDTH);
+#ifndef UINT64_WIDTH
+# error "missing UINT64_WIDTH"
+#endif
+  CHECK_WIDTH (uint64_t, UINT64_MAX, UINT64_WIDTH);
+
+#ifndef INT_LEAST8_WIDTH
+# error "missing INT_LEAST8_WIDTH"
+#endif
+  CHECK_WIDTH (int_least8_t, INT_LEAST8_MAX, INT_LEAST8_WIDTH);
+#ifndef INT_LEAST16_WIDTH
+# error "missing INT_LEAST16_WIDTH"
+#endif
+  CHECK_WIDTH (int_least16_t, INT_LEAST16_MAX, INT_LEAST16_WIDTH);
+#ifndef INT_LEAST32_WIDTH
+# error "missing INT_LEAST32_WIDTH"
+#endif
+  CHECK_WIDTH (int_least32_t, INT_LEAST32_MAX, INT_LEAST32_WIDTH);
+#ifndef INT_LEAST64_WIDTH
+# error "missing INT_LEAST64_WIDTH"
+#endif
+  CHECK_WIDTH (int_least64_t, INT_LEAST64_MAX, INT_LEAST64_WIDTH);
+#ifndef UINT_LEAST8_WIDTH
+# error "missing UINT_LEAST8_WIDTH"
+#endif
+  CHECK_WIDTH (uint_least8_t, UINT_LEAST8_MAX, UINT_LEAST8_WIDTH);
+#ifndef UINT_LEAST16_WIDTH
+# error "missing UINT_LEAST16_WIDTH"
+#endif
+  CHECK_WIDTH (uint_least16_t, UINT_LEAST16_MAX, UINT_LEAST16_WIDTH);
+#ifndef UINT_LEAST32_WIDTH
+# error "missing UINT_LEAST32_WIDTH"
+#endif
+  CHECK_WIDTH (uint_least32_t, UINT_LEAST32_MAX, UINT_LEAST32_WIDTH);
+#ifndef UINT_LEAST64_WIDTH
+# error "missing UINT_LEAST64_WIDTH"
+#endif
+  CHECK_WIDTH (uint_least64_t, UINT_LEAST64_MAX, UINT_LEAST64_WIDTH);
+
+#ifndef INT_FAST8_WIDTH
+# error "missing INT_FAST8_WIDTH"
+#endif
+  CHECK_WIDTH (int_fast8_t, INT_FAST8_MAX, INT_FAST8_WIDTH);
+#ifndef INT_FAST16_WIDTH
+# error "missing INT_FAST16_WIDTH"
+#endif
+  CHECK_WIDTH (int_fast16_t, INT_FAST16_MAX, INT_FAST16_WIDTH);
+#ifndef INT_FAST32_WIDTH
+# error "missing INT_FAST32_WIDTH"
+#endif
+  CHECK_WIDTH (int_fast32_t, INT_FAST32_MAX, INT_FAST32_WIDTH);
+#ifndef INT_FAST64_WIDTH
+# error "missing INT_FAST64_WIDTH"
+#endif
+  CHECK_WIDTH (int_fast64_t, INT_FAST64_MAX, INT_FAST64_WIDTH);
+#ifndef UINT_FAST8_WIDTH
+# error "missing UINT_FAST8_WIDTH"
+#endif
+  CHECK_WIDTH (uint_fast8_t, UINT_FAST8_MAX, UINT_FAST8_WIDTH);
+#ifndef UINT_FAST16_WIDTH
+# error "missing UINT_FAST16_WIDTH"
+#endif
+  CHECK_WIDTH (uint_fast16_t, UINT_FAST16_MAX, UINT_FAST16_WIDTH);
+#ifndef UINT_FAST32_WIDTH
+# error "missing UINT_FAST32_WIDTH"
+#endif
+  CHECK_WIDTH (uint_fast32_t, UINT_FAST32_MAX, UINT_FAST32_WIDTH);
+#ifndef UINT_FAST64_WIDTH
+# error "missing UINT_FAST64_WIDTH"
+#endif
+  CHECK_WIDTH (uint_fast64_t, UINT_FAST64_MAX, UINT_FAST64_WIDTH);
+
+#ifndef INTPTR_WIDTH
+# error "missing INTPTR_WIDTH"
+#endif
+  CHECK_WIDTH (intptr_t, INTPTR_MAX, INTPTR_WIDTH);
+#ifndef UINTPTR_WIDTH
+# error "missing UINTPTR_WIDTH"
+#endif
+  CHECK_WIDTH (uintptr_t, UINTPTR_MAX, UINTPTR_WIDTH);
+
+#ifndef INTMAX_WIDTH
+# error "missing INTMAX_WIDTH"
+#endif
+  CHECK_WIDTH (intmax_t, INTMAX_MAX, INTMAX_WIDTH);
+#ifndef UINTMAX_WIDTH
+# error "missing UINTMAX_WIDTH"
+#endif
+  CHECK_WIDTH (uintmax_t, UINTMAX_MAX, UINTMAX_WIDTH);
+
+#ifndef PTRDIFF_WIDTH
+# error "missing PTRDIFF_WIDTH"
+#endif
+  CHECK_WIDTH (ptrdiff_t, PTRDIFF_MAX, PTRDIFF_WIDTH);
+#ifndef SIG_ATOMIC_WIDTH
+# error "missing SIG_ATOMIC_WIDTH"
+#endif
+  CHECK_WIDTH (sig_atomic_t, SIG_ATOMIC_MAX, SIG_ATOMIC_WIDTH);
+#ifndef SIZE_WIDTH
+# error "missing SIZE_WIDTH"
+#endif
+  CHECK_WIDTH (size_t, SIZE_MAX, SIZE_WIDTH);
+#ifndef WCHAR_WIDTH
+# error "missing WCHAR_WIDTH"
+#endif
+  CHECK_WIDTH (wchar_t, WCHAR_MAX, WCHAR_WIDTH);
+#ifndef WINT_WIDTH
+# error "missing WINT_WIDTH"
+#endif
+  CHECK_WIDTH (wint_t, WINT_MAX, WINT_WIDTH);
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 4427627..5428dbc 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -22,7 +22,8 @@ 
 #ifndef _STDINT_H
 #define _STDINT_H	1
 
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
 #include <bits/wchar.h>
 #include <bits/wordsize.h>
 
@@ -307,4 +308,47 @@  typedef unsigned long long int	uintmax_t;
 #  define UINTMAX_C(c)	c ## ULL
 # endif
 
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+
+# define INT8_WIDTH 8
+# define UINT8_WIDTH 8
+# define INT16_WIDTH 16
+# define UINT16_WIDTH 16
+# define INT32_WIDTH 32
+# define UINT32_WIDTH 32
+# define INT64_WIDTH 64
+# define UINT64_WIDTH 64
+
+# define INT_LEAST8_WIDTH 8
+# define UINT_LEAST8_WIDTH 8
+# define INT_LEAST16_WIDTH 16
+# define UINT_LEAST16_WIDTH 16
+# define INT_LEAST32_WIDTH 32
+# define UINT_LEAST32_WIDTH 32
+# define INT_LEAST64_WIDTH 64
+# define UINT_LEAST64_WIDTH 64
+
+# define INT_FAST8_WIDTH 8
+# define UINT_FAST8_WIDTH 8
+# define INT_FAST16_WIDTH __WORDSIZE
+# define UINT_FAST16_WIDTH __WORDSIZE
+# define INT_FAST32_WIDTH __WORDSIZE
+# define UINT_FAST32_WIDTH __WORDSIZE
+# define INT_FAST64_WIDTH 64
+# define UINT_FAST64_WIDTH 64
+
+# define INTPTR_WIDTH __WORDSIZE
+# define UINTPTR_WIDTH __WORDSIZE
+
+# define INTMAX_WIDTH 64
+# define UINTMAX_WIDTH 64
+
+# define PTRDIFF_WIDTH __WORDSIZE
+# define SIG_ATOMIC_WIDTH 32
+# define SIZE_WIDTH __WORDSIZE
+# define WCHAR_WIDTH 32
+# define WINT_WIDTH 32
+
+#endif
+
 #endif /* stdint.h */