X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstdint_.h;h=4fa52516d7bc3a2460253b8b39ebcc3e6b2775d5;hb=5d0b385594bc914e6233988bfb6bc1b92a2184b5;hp=c29108f2cac3149de7dab160d92a3dc8ad1c07ea;hpb=8b794fd95e474cbe19ee9a63e87cb3378935539e;p=gnulib.git diff --git a/lib/stdint_.h b/lib/stdint_.h index c29108f2c..4fa52516d 100644 --- a/lib/stdint_.h +++ b/lib/stdint_.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -82,11 +82,7 @@ #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS /* Get WCHAR_MIN, WCHAR_MAX. */ -# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) - /* BSD/OS 4.1 has a bug: and must be included before - . */ -# include -# include +# if ! (defined WCHAR_MIN && defined WCHAR_MAX) # include # endif @@ -124,22 +120,34 @@ #define int32_t int #define uint32_t unsigned int -#undef int64_t +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ #if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t # define int64_t long int +# define GL_INT64_T #elif defined _MSC_VER +# undef int64_t # define int64_t __int64 +# define GL_INT64_T #elif @HAVE_LONG_LONG_INT@ +# undef int64_t # define int64_t long long int +# define GL_INT64_T #endif -#undef uint64_t #if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t # define uint64_t unsigned long int +# define GL_UINT64_T #elif defined _MSC_VER +# undef uint64_t # define uint64_t unsigned __int64 +# define GL_UINT64_T #elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t # define uint64_t unsigned long long int +# define GL_UINT64_T #endif /* Avoid collision with Solaris 2.5.1 etc. */ @@ -168,10 +176,10 @@ #define uint_least16_t uint16_t #define int_least32_t int32_t #define uint_least32_t uint32_t -#ifdef int64_t +#ifdef GL_INT64_T # define int_least64_t int64_t #endif -#ifdef uint64_t +#ifdef GL_UINT64_T # define uint_least64_t uint64_t #endif @@ -199,10 +207,10 @@ #define uint_fast16_t unsigned int_fast16_t #define int_fast32_t long int #define uint_fast32_t unsigned int_fast32_t -#ifdef int64_t +#ifdef GL_INT64_T # define int_fast64_t int64_t #endif -#ifdef uint64_t +#ifdef GL_UINT64_T # define uint_fast64_t uint64_t #endif @@ -221,7 +229,7 @@ #undef intmax_t #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define intmax_t long long int -#elif defined int64_t +#elif defined GL_INT64_T # define intmax_t int64_t #else # define intmax_t long int @@ -230,7 +238,7 @@ #undef uintmax_t #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define uintmax_t unsigned long long int -#elif defined int64_t +#elif defined GL_UINT64_T # define uintmax_t uint64_t #else # define uintmax_t unsigned long int @@ -268,13 +276,15 @@ #undef INT64_MIN #undef INT64_MAX -#ifdef int64_t -# define INT64_MIN (~ INT64_MAX) +#ifdef GL_INT64_T +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) # define INT64_MAX INTMAX_C (9223372036854775807) #endif #undef UINT64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif @@ -307,13 +317,13 @@ #undef INT_LEAST64_MIN #undef INT_LEAST64_MAX -#ifdef int64_t +#ifdef GL_INT64_T # define INT_LEAST64_MIN INT64_MIN # define INT_LEAST64_MAX INT64_MAX #endif #undef UINT_LEAST64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT_LEAST64_MAX UINT64_MAX #endif @@ -346,13 +356,13 @@ #undef INT_FAST64_MIN #undef INT_FAST64_MAX -#ifdef int64_t +#ifdef GL_INT64_T # define INT_FAST64_MIN INT64_MIN # define INT_FAST64_MAX INT64_MAX #endif #undef UINT_FAST64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT_FAST64_MAX UINT64_MAX #endif @@ -369,10 +379,11 @@ #undef INTMAX_MIN #undef INTMAX_MAX -#define INTMAX_MIN (~ INTMAX_MAX) #ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN # define INTMAX_MAX INT64_MAX #else +# define INTMAX_MIN INT32_MIN # define INTMAX_MAX INT32_MAX #endif @@ -473,7 +484,7 @@ #undef INTMAX_C #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define INTMAX_C(x) x##LL -#elif defined int64_t +#elif defined GL_INT64_T # define INTMAX_C(x) INT64_C(x) #else # define INTMAX_C(x) x##L @@ -482,7 +493,7 @@ #undef UINTMAX_C #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define UINTMAX_C(x) x##ULL -#elif defined uint64_t +#elif defined GL_UINT64_T # define UINTMAX_C(x) UINT64_C(x) #else # define UINTMAX_C(x) x##UL