Index: include/grub/types.h =================================================================== --- include/grub/types.h (revision 2438) +++ include/grub/types.h (working copy) @@ -58,23 +58,53 @@ # endif #endif -/* Define various wide integers. */ +/* Define various wide integers and their format specifiers. */ typedef signed char grub_int8_t; typedef short grub_int16_t; typedef int grub_int32_t; -#if GRUB_CPU_SIZEOF_VOID_P == 8 +#define GRUB_PRIi8 i +#define GRUB_PRIi16 i +#define GRUB_PRIi32 i +#define GRUB_PRId8 d +#define GRUB_PRId16 d +#define GRUB_PRId32 d +#if GRUB_CPU_SIZEOF_LONG == 8 typedef long grub_int64_t; +#define GRUB_PRIi64 li +#define GRUB_PRId64 ld #else typedef long long grub_int64_t; +#define GRUB_PRIi64 lli +#define GRUB_PRId64 lld #endif typedef unsigned char grub_uint8_t; typedef unsigned short grub_uint16_t; typedef unsigned grub_uint32_t; -#if GRUB_CPU_SIZEOF_VOID_P == 8 +#define GRUB_PRIu8 u +#define GRUB_PRIu16 u +#define GRUB_PRIu32 u +#define GRUB_PRIo8 o +#define GRUB_PRIo16 o +#define GRUB_PRIo32 o +#define GRUB_PRIx8 x +#define GRUB_PRIx16 x +#define GRUB_PRIx32 x +#define GRUB_PRIX8 X +#define GRUB_PRIX16 X +#define GRUB_PRIX32 X +#if GRUB_CPU_SIZEOF_LONG == 8 typedef unsigned long grub_uint64_t; +#define GRUB_PRIu64 lu +#define GRUB_PRIo64 lo +#define GRUB_PRIx64 lx +#define GRUB_PRIX64 lX #else typedef unsigned long long grub_uint64_t; +#define GRUB_PRIu64 llu +#define GRUB_PRIo64 llo +#define GRUB_PRIx64 llx +#define GRUB_PRIX64 llX #endif /* Misc types. */ @@ -100,7 +130,7 @@ typedef grub_int32_t grub_ssize_t; #endif -#if GRUB_CPU_SIZEOF_VOID_P == 8 +#if GRUB_CPU_SIZEOF_LONG == 8 # define GRUB_ULONG_MAX 18446744073709551615UL # define GRUB_LONG_MAX 9223372036854775807L # define GRUB_LONG_MIN (-9223372036854775807L - 1)