2003-04-22 22:55:01 +08:00
|
|
|
/* stdint.h - integer types
|
|
|
|
|
2013-01-21 12:38:31 +08:00
|
|
|
Copyright 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Red Hat, Inc.
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#ifndef _STDINT_H
|
|
|
|
#define _STDINT_H
|
|
|
|
|
|
|
|
/* Exact-width integer types */
|
|
|
|
|
|
|
|
#ifndef __int8_t_defined
|
|
|
|
#define __int8_t_defined
|
|
|
|
typedef signed char int8_t;
|
|
|
|
typedef short int16_t;
|
2008-05-18 05:34:05 +08:00
|
|
|
typedef int int32_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef long int64_t;
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef long long int64_t;
|
|
|
|
#endif
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
#ifndef __uint32_t_defined
|
|
|
|
#define __uint32_t_defined
|
2008-05-18 05:34:05 +08:00
|
|
|
typedef unsigned int uint32_t;
|
2003-04-22 22:55:01 +08:00
|
|
|
#endif
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef unsigned long uint64_t;
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef unsigned long long uint64_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Minimum-width integer types */
|
|
|
|
|
|
|
|
typedef signed char int_least8_t;
|
|
|
|
typedef short int_least16_t;
|
2009-04-08 01:23:20 +08:00
|
|
|
typedef int int_least32_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef long int_least64_t;
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef long long int_least64_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
typedef unsigned char uint_least8_t;
|
|
|
|
typedef unsigned short uint_least16_t;
|
2009-04-08 01:23:20 +08:00
|
|
|
typedef unsigned int uint_least32_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef unsigned long uint_least64_t;
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef unsigned long long uint_least64_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Fastest minimum-width integer types */
|
|
|
|
|
|
|
|
typedef signed char int_fast8_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef long int_fast16_t;
|
|
|
|
typedef long int_fast32_t;
|
|
|
|
typedef long int_fast64_t;
|
|
|
|
#else
|
2009-04-08 01:23:20 +08:00
|
|
|
typedef int int_fast16_t;
|
|
|
|
typedef int int_fast32_t;
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef long long int_fast64_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
typedef unsigned char uint_fast8_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef unsigned long uint_fast16_t;
|
|
|
|
typedef unsigned long uint_fast32_t;
|
|
|
|
typedef unsigned long uint_fast64_t;
|
|
|
|
#else
|
2009-04-08 01:23:20 +08:00
|
|
|
typedef unsigned int uint_fast16_t;
|
|
|
|
typedef unsigned int uint_fast32_t;
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef unsigned long long uint_fast64_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Integer types capable of holding object pointers */
|
|
|
|
|
|
|
|
#ifndef __intptr_t_defined
|
|
|
|
#define __intptr_t_defined
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef long intptr_t;
|
|
|
|
#else
|
2009-04-14 06:55:00 +08:00
|
|
|
typedef int intptr_t;
|
2003-04-22 22:55:01 +08:00
|
|
|
#endif
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef unsigned long uintptr_t;
|
|
|
|
#else
|
2009-04-14 06:55:00 +08:00
|
|
|
typedef unsigned int uintptr_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Greatest-width integer types */
|
|
|
|
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef long intmax_t;
|
|
|
|
typedef unsigned long uintmax_t;
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
typedef long long intmax_t;
|
|
|
|
typedef unsigned long long uintmax_t;
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* C99 requires that in C++ the following macros should be defined only
|
|
|
|
if requested. */
|
|
|
|
#if !defined (__cplusplus) || defined (__STDC_LIMIT_MACROS) \
|
|
|
|
|| defined (__INSIDE_CYGWIN__)
|
|
|
|
|
|
|
|
#if __x86_64__
|
|
|
|
# define __I64(n) n ## L
|
|
|
|
# define __U64(n) n ## UL
|
|
|
|
#else
|
|
|
|
# define __I64(n) n ## LL
|
|
|
|
# define __U64(n) n ## ULL
|
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of exact-width integer types */
|
|
|
|
|
|
|
|
#define INT8_MIN (-128)
|
|
|
|
#define INT16_MIN (-32768)
|
2003-10-29 16:43:10 +08:00
|
|
|
#define INT32_MIN (-2147483647 - 1)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define INT64_MIN (-__I64(9223372036854775807) - 1)
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define INT8_MAX (127)
|
|
|
|
#define INT16_MAX (32767)
|
|
|
|
#define INT32_MAX (2147483647)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define INT64_MAX (__I64(9223372036854775807))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define UINT8_MAX (255)
|
|
|
|
#define UINT16_MAX (65535)
|
2009-04-08 01:23:20 +08:00
|
|
|
#define UINT32_MAX (4294967295U)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define UINT64_MAX (__U64(18446744073709551615))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of minimum-width integer types */
|
|
|
|
|
|
|
|
#define INT_LEAST8_MIN (-128)
|
|
|
|
#define INT_LEAST16_MIN (-32768)
|
2003-10-29 16:43:10 +08:00
|
|
|
#define INT_LEAST32_MIN (-2147483647 - 1)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define INT_LEAST64_MIN (-__I64(9223372036854775807) - 1)
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define INT_LEAST8_MAX (127)
|
|
|
|
#define INT_LEAST16_MAX (32767)
|
|
|
|
#define INT_LEAST32_MAX (2147483647)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define INT_LEAST64_MAX (__I64(9223372036854775807))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define UINT_LEAST8_MAX (255)
|
|
|
|
#define UINT_LEAST16_MAX (65535)
|
2009-04-08 01:23:20 +08:00
|
|
|
#define UINT_LEAST32_MAX (4294967295U)
|
2012-07-28 22:21:34 +08:00
|
|
|
#define UINT_LEAST64_MAX (__U64(18446744073709551615))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of fastest minimum-width integer types */
|
|
|
|
|
|
|
|
#define INT_FAST8_MIN (-128)
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define INT_FAST16_MIN (-__I64(9223372036854775807) - 1)
|
|
|
|
#define INT_FAST32_MIN (-__I64(9223372036854775807) - 1)
|
|
|
|
#else
|
2003-10-29 16:43:10 +08:00
|
|
|
#define INT_FAST16_MIN (-2147483647 - 1)
|
|
|
|
#define INT_FAST32_MIN (-2147483647 - 1)
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
#define INT_FAST64_MIN (-__I64(9223372036854775807) - 1)
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define INT_FAST8_MAX (127)
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define INT_FAST16_MAX (__I64(9223372036854775807))
|
|
|
|
#define INT_FAST32_MAX (__I64(9223372036854775807))
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
#define INT_FAST16_MAX (2147483647)
|
|
|
|
#define INT_FAST32_MAX (2147483647)
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
#define INT_FAST64_MAX (__I64(9223372036854775807))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#define UINT_FAST8_MAX (255)
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define UINT_FAST16_MAX (__U64(18446744073709551615))
|
|
|
|
#define UINT_FAST32_MAX (__U64(18446744073709551615))
|
|
|
|
#else
|
2009-04-08 01:23:20 +08:00
|
|
|
#define UINT_FAST16_MAX (4294967295U)
|
|
|
|
#define UINT_FAST32_MAX (4294967295U)
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
#define UINT_FAST64_MAX (__U64(18446744073709551615))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of integer types capable of holding object pointers */
|
|
|
|
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define INTPTR_MIN (-__I64(9223372036854775807) - 1)
|
|
|
|
#define INTPTR_MAX (__I64(9223372036854775807)
|
|
|
|
#define UINTPTR_MAX (__U64(18446744073709551615))
|
|
|
|
#else
|
2009-04-14 06:55:00 +08:00
|
|
|
#define INTPTR_MIN (-2147483647 - 1)
|
|
|
|
#define INTPTR_MAX (2147483647)
|
|
|
|
#define UINTPTR_MAX (4294967295U)
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of greatest-width integer types */
|
|
|
|
|
2012-07-28 22:21:34 +08:00
|
|
|
#define INTMAX_MIN (-__I64(9223372036854775807) - 1)
|
|
|
|
#define INTMAX_MAX (__I64(9223372036854775807))
|
|
|
|
#define UINTMAX_MAX (__U64(18446744073709551615))
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Limits of other integer types */
|
|
|
|
|
|
|
|
#ifndef PTRDIFF_MIN
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define PTRDIFF_MIN (-9223372036854775807L - 1)
|
|
|
|
#define PTRDIFF_MAX (9223372036854775807L)
|
|
|
|
#else
|
2003-10-29 16:43:10 +08:00
|
|
|
#define PTRDIFF_MIN (-2147483647 - 1)
|
2003-04-22 22:55:01 +08:00
|
|
|
#define PTRDIFF_MAX (2147483647)
|
|
|
|
#endif
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#ifndef SIG_ATOMIC_MIN
|
2003-10-29 16:43:10 +08:00
|
|
|
#define SIG_ATOMIC_MIN (-2147483647 - 1)
|
2003-04-22 22:55:01 +08:00
|
|
|
#endif
|
|
|
|
#ifndef SIG_ATOMIC_MAX
|
|
|
|
#define SIG_ATOMIC_MAX (2147483647)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef SIZE_MAX
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define SIZE_MAX (18446744073709551615UL)
|
|
|
|
#else
|
2009-04-11 16:07:30 +08:00
|
|
|
#define SIZE_MAX (4294967295U)
|
2003-04-22 22:55:01 +08:00
|
|
|
#endif
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#ifndef WCHAR_MIN
|
|
|
|
#ifdef __WCHAR_MIN__
|
|
|
|
#define WCHAR_MIN __WCHAR_MIN__
|
|
|
|
#define WCHAR_MAX __WCHAR_MAX__
|
|
|
|
#else
|
|
|
|
#define WCHAR_MIN (0)
|
|
|
|
#define WCHAR_MAX (65535)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WINT_MIN
|
2007-04-06 16:25:28 +08:00
|
|
|
#define WINT_MIN 0U
|
2009-04-11 16:07:30 +08:00
|
|
|
#define WINT_MAX (4294967295U)
|
2003-04-22 22:55:01 +08:00
|
|
|
#endif
|
|
|
|
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif /* !__cplusplus || __STDC_LIMIT_MACROS || __INSIDE_CYGWIN__ */
|
|
|
|
|
|
|
|
/* C99 requires that in C++ the following macros should be defined only
|
|
|
|
if requested. */
|
|
|
|
#if !defined (__cplusplus) || defined (__STDC_CONSTANT_MACROS) \
|
|
|
|
|| defined (__INSIDE_CYGWIN__)
|
|
|
|
|
2003-04-22 22:55:01 +08:00
|
|
|
/* Macros for minimum-width integer constant expressions */
|
|
|
|
|
|
|
|
#define INT8_C(x) x
|
|
|
|
#define INT16_C(x) x
|
2009-04-08 01:23:20 +08:00
|
|
|
#define INT32_C(x) x
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define INT64_C(x) x ## L
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
#define INT64_C(x) x ## LL
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
2006-07-03 20:30:04 +08:00
|
|
|
#define UINT8_C(x) x
|
|
|
|
#define UINT16_C(x) x
|
2009-04-08 01:23:20 +08:00
|
|
|
#define UINT32_C(x) x ## U
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define UINT64_C(x) x ## UL
|
|
|
|
#else
|
2003-04-22 22:55:01 +08:00
|
|
|
#define UINT64_C(x) x ## ULL
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
/* Macros for greatest-width integer constant expressions */
|
|
|
|
|
2012-07-28 22:21:34 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define INTMAX_C(x) x ## L
|
|
|
|
#define UINTMAX_C(x) x ## UL
|
|
|
|
#else
|
2005-05-23 21:13:00 +08:00
|
|
|
#define INTMAX_C(x) x ## LL
|
|
|
|
#define UINTMAX_C(x) x ## ULL
|
2012-07-28 22:21:34 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* !__cplusplus || __STDC_CONSTANT_MACROS || __INSIDE_CYGWIN__ */
|
2003-04-22 22:55:01 +08:00
|
|
|
|
|
|
|
#endif /* _STDINT_H */
|