Additions to inttypes.h format strings
This commit is contained in:
@@ -24,19 +24,33 @@
|
||||
#define PRI16 ""
|
||||
#define PRILEAST16 ""
|
||||
#define PRIFAST16 ""
|
||||
#if _WORD_SIZE == 2
|
||||
#define PRI32 "l"
|
||||
#define PRILEAST32 "l"
|
||||
#define PRIFAST32 "l"
|
||||
#else
|
||||
|
||||
#if __SIZEOF_LONG__ > 4
|
||||
#define PRI32 ""
|
||||
#define PRILEAST32 ""
|
||||
#define PRIFAST32 ""
|
||||
#else
|
||||
#define PRI32 "l"
|
||||
#endif
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#define PRILEAST32 PRI32
|
||||
#define PRIFAST32 PRI32
|
||||
|
||||
#if defined(__LONG_LONG_SUPPORTED)
|
||||
#define PRI64 "ll"
|
||||
#elif _WORD_SIZE > 2 && __L64
|
||||
#define PRI64 "l"
|
||||
#define PRILEAST64 "l"
|
||||
#define PRIFAST64 "l"
|
||||
#endif
|
||||
|
||||
#ifdef PRI64
|
||||
#define PRILEAST64 PRI64
|
||||
#define PRIFAST64 PRI64
|
||||
#define PRIMAX PRI64
|
||||
#else
|
||||
#define PRIMAX PRI32
|
||||
#endif
|
||||
|
||||
#if _PTR_SIZE == _WORD_SIZE
|
||||
#define PRIPTR ""
|
||||
#elif _PTR_SIZE == 2*_WORD_SIZE
|
||||
#define PRIPTR "l"
|
||||
#endif
|
||||
|
||||
/* Macros for fprintf, the ones defined by the standard. */
|
||||
@@ -49,11 +63,13 @@
|
||||
#define PRId32 PRI32"d"
|
||||
#define PRIdLEAST32 PRILEAST32"d"
|
||||
#define PRIdFAST32 PRIFAST32"d"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRId64 PRI64"d"
|
||||
#define PRIdLEAST64 PRILEAST64"d"
|
||||
#define PRIdFAST64 PRIFAST64"d"
|
||||
#endif
|
||||
#define PRIdMAX PRIMAX"d"
|
||||
#define PRIdPTR PRIPTR"d"
|
||||
|
||||
#define PRIi8 PRI8"i"
|
||||
#define PRIiLEAST8 PRILEAST8"i"
|
||||
@@ -64,11 +80,13 @@
|
||||
#define PRIi32 PRI32"i"
|
||||
#define PRIiLEAST32 PRILEAST32"i"
|
||||
#define PRIiFAST32 PRIFAST32"i"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRIi64 PRI64"i"
|
||||
#define PRIiLEAST64 PRILEAST64"i"
|
||||
#define PRIiFAST64 PRIFAST64"i"
|
||||
#endif
|
||||
#define PRIiMAX PRIMAX"i"
|
||||
#define PRIiPTR PRIPTR"i"
|
||||
|
||||
#define PRIo8 PRI8"o"
|
||||
#define PRIoLEAST8 PRILEAST8"o"
|
||||
@@ -79,11 +97,13 @@
|
||||
#define PRIo32 PRI32"o"
|
||||
#define PRIoLEAST32 PRILEAST32"o"
|
||||
#define PRIoFAST32 PRIFAST32"o"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRIo64 PRI64"o"
|
||||
#define PRIoLEAST64 PRILEAST64"o"
|
||||
#define PRIoFAST64 PRIFAST64"o"
|
||||
#endif
|
||||
#define PRIoMAX PRIMAX"o"
|
||||
#define PRIoPTR PRIPTR"o"
|
||||
|
||||
#define PRIu8 PRI8"u"
|
||||
#define PRIuLEAST8 PRILEAST8"u"
|
||||
@@ -94,11 +114,13 @@
|
||||
#define PRIu32 PRI32"u"
|
||||
#define PRIuLEAST32 PRILEAST32"u"
|
||||
#define PRIuFAST32 PRIFAST32"u"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRIu64 PRI64"u"
|
||||
#define PRIuLEAST64 PRILEAST64"u"
|
||||
#define PRIuFAST64 PRIFAST64"u"
|
||||
#endif
|
||||
#define PRIuMAX PRIMAX"u"
|
||||
#define PRIuPTR PRIPTR"u"
|
||||
|
||||
#define PRIx8 PRI8"x"
|
||||
#define PRIxLEAST8 PRILEAST8"x"
|
||||
@@ -109,11 +131,13 @@
|
||||
#define PRIx32 PRI32"x"
|
||||
#define PRIxLEAST32 PRILEAST32"x"
|
||||
#define PRIxFAST32 PRIFAST32"x"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRIx64 PRI64"x"
|
||||
#define PRIxLEAST64 PRILEAST64"x"
|
||||
#define PRIxFAST64 PRIFAST64"x"
|
||||
#endif
|
||||
#define PRIxMAX PRIMAX"x"
|
||||
#define PRIxPTR PRIPTR"x"
|
||||
|
||||
#define PRIX8 PRI8"X"
|
||||
#define PRIXLEAST8 PRILEAST8"X"
|
||||
@@ -124,11 +148,13 @@
|
||||
#define PRIX32 PRI32"X"
|
||||
#define PRIXLEAST32 PRILEAST32"X"
|
||||
#define PRIXFAST32 PRIFAST32"X"
|
||||
#if _WORD_SIZE > 2 && __L64
|
||||
#ifdef PRI64
|
||||
#define PRIX64 PRI64"X"
|
||||
#define PRIXLEAST64 PRILEAST64"X"
|
||||
#define PRIXFAST64 PRIFAST64"X"
|
||||
#endif
|
||||
#define PRIXMAX PRIMAX"X"
|
||||
#define PRIXPTR PRIPTR"X"
|
||||
|
||||
/* Macros to scan integers with fscanf(), nonstandard first group. */
|
||||
#define SCN8 "hh"
|
||||
@@ -230,7 +256,12 @@
|
||||
#endif /* !__cplusplus || __STDC_FORMAT_MACROS */
|
||||
|
||||
/* Integer conversion functions for [u]intmax_t. */
|
||||
#ifdef __LONG_LONG_SUPPORTED
|
||||
#define stroimax(nptr, endptr, base) strtoll(nptr, endptr, base)
|
||||
#define stroumax(nptr, endptr, base) strtoull(nptr, endptr, base)
|
||||
#else
|
||||
#define stroimax(nptr, endptr, base) strtol(nptr, endptr, base)
|
||||
#define stroumax(nptr, endptr, base) strtoul(nptr, endptr, base)
|
||||
#endif
|
||||
|
||||
#endif /* _INTTYPES_H */
|
||||
|
||||
@@ -87,8 +87,14 @@ typedef unsigned uintptr_t;
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#endif
|
||||
|
||||
#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#else
|
||||
typedef long intmax_t;
|
||||
typedef unsigned long uintmax_t;
|
||||
#endif
|
||||
|
||||
#if !__cplusplus || defined(__STDC_LIMIT_MACROS)
|
||||
#ifndef _LIMITS_H
|
||||
@@ -178,9 +184,16 @@ typedef unsigned long uintmax_t;
|
||||
#define INTPTR_MAX LONG_MAX
|
||||
#define UINTPTR_MAX ULONG_MAX
|
||||
#endif
|
||||
|
||||
#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
#else
|
||||
#define INTMAX_MIN LONG_MIN
|
||||
#define INTMAX_MAX LONG_MAX
|
||||
#define UINTMAX_MAX ULONG_MAX
|
||||
#endif
|
||||
|
||||
#endif /* !__cplusplus || __STDC_LIMIT_MACROS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user