inttypes.h on x86-64
Jeff Johnston
jjohnstn@redhat.com
Mon Jan 19 22:03:00 GMT 2009
Hi Neal,
Patch applied. I changed your ChangeLog comment as you seemed to have
it backwards
in the explanation.
-- Jeff J.
Neal H. Walfield wrote:
> The attached patch seems to fix the problem. I've tested the changes
> on x86-64 and x86 with newlib 1.16. I've generated the attached patch
> relative to CVS head.
>
> Neal
>
> 2009-01-18 Neal H. Walfield <neal@gnu.org>
>
> * libc/include/stdint.h (INT64_C, UINT64_C, INTMAX_C, UINTMAX_C)
> [__have_long64 && __have_longlong64]: Use LL and ULL, not L or UL.
> * libc/include/inttypes.h (__PRI64, __SCN64, __PRIMAX, __SCNMAX,
> __PRIPTR, __SCNPTR) [__have_long64 && __have_longlong64]: Use ll,
> not l.
>
> Index: newlib/libc/include/inttypes.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
> retrieving revision 1.3
> diff -u -p -r1.3 inttypes.h
> --- newlib/libc/include/inttypes.h 16 Dec 2005 19:03:12 -0000 1.3
> +++ newlib/libc/include/inttypes.h 18 Jan 2009 16:59:41 -0000
> @@ -163,12 +163,12 @@
>
>
> /* 64-bit types */
> -#if __have_longlong64
> -#define __PRI64(x) __STRINGIFY(ll##x)
> -#define __SCN64(x) __STRINGIFY(ll##x)
> -#elif __have_long64
> +#if __have_long64
> #define __PRI64(x) __STRINGIFY(l##x)
> #define __SCN64(x) __STRINGIFY(l##x)
> +#elif __have_longlong64
> +#define __PRI64(x) __STRINGIFY(ll##x)
> +#define __SCN64(x) __STRINGIFY(ll##x)
> #else
> #define __PRI64(x) __STRINGIFY(x)
> #define __SCN64(x) __STRINGIFY(x)
> @@ -217,12 +217,12 @@
> #endif
>
> /* max-bit types */
> -#if __have_longlong64
> -#define __PRIMAX(x) __STRINGIFY(ll##x)
> -#define __SCNMAX(x) __STRINGIFY(ll##x)
> -#elif __have_long64
> +#if __have_long64
> #define __PRIMAX(x) __STRINGIFY(l##x)
> #define __SCNMAX(x) __STRINGIFY(l##x)
> +#elif __have_longlong64
> +#define __PRIMAX(x) __STRINGIFY(ll##x)
> +#define __SCNMAX(x) __STRINGIFY(ll##x)
> #else
> #define __PRIMAX(x) __STRINGIFY(x)
> #define __SCNMAX(x) __STRINGIFY(x)
> @@ -242,12 +242,12 @@
> #define SCNxMAX __SCNMAX(x)
>
> /* ptr types */
> -#if __have_longlong64
> -#define __PRIPTR(x) __STRINGIFY(ll##x)
> -#define __SCNPTR(x) __STRINGIFY(ll##x)
> -#elif __have_long64
> +#if __have_long64
> #define __PRIPTR(x) __STRINGIFY(l##x)
> #define __SCNPTR(x) __STRINGIFY(l##x)
> +#elif __have_longlong64
> +#define __PRIPTR(x) __STRINGIFY(ll##x)
> +#define __SCNPTR(x) __STRINGIFY(ll##x)
> #else
> #define __PRIPTR(x) __STRINGIFY(x)
> #define __SCNPTR(x) __STRINGIFY(x)
> Index: newlib/libc/include/stdint.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 stdint.h
> --- newlib/libc/include/stdint.h 10 Dec 2008 21:27:58 -0000 1.12
> +++ newlib/libc/include/stdint.h 18 Jan 2009 16:59:42 -0000
> @@ -457,22 +457,22 @@ typedef unsigned long uintptr_t;
> #endif
>
> #if __int64_t_defined
> -#if __have_longlong64
> -#define INT64_C(x) x##LL
> -#define UINT64_C(x) x##ULL
> -#else
> +#if __have_long64
> #define INT64_C(x) x##L
> #define UINT64_C(x) x##UL
> +#else
> +#define INT64_C(x) x##LL
> +#define UINT64_C(x) x##ULL
> #endif
> #endif
>
> /** Macros for greatest-width integer constant expression */
> -#if __have_longlong64
> -#define INTMAX_C(x) x##LL
> -#define UINTMAX_C(x) x##ULL
> -#else
> +#if __have_long64
> #define INTMAX_C(x) x##L
> #define UINTMAX_C(x) x##UL
> +#else
> +#define INTMAX_C(x) x##LL
> +#define UINTMAX_C(x) x##ULL
> #endif
>
>
>
>
More information about the Newlib
mailing list