#ifndef STD_INTTYPES_H_
#define STD_INTTYPES_H_

#include <stdint.h>

#define __PRI8   "hh"
#define __PRI16  "h"
#define __PRI32  ""
#define __PRI64  "ll"

#define PRId8     __PRI8 "d"
#define PRIi8     __PRI8 "i"
#define PRIo8     __PRI8 "o"
#define PRIu8     __PRI8 "u"
#define PRIx8     __PRI8 "x"
#define PRIX8     __PRI8 "X"

#define PRId16    __PRI16 "d"
#define PRIi16    __PRI16 "i"
#define PRIo16    __PRI16 "o"
#define PRIu16    __PRI16 "u"
#define PRIx16    __PRI16 "x"
#define PRIX16    __PRI16 "X"

#define PRId32    __PRI32 "d"
#define PRIi32    __PRI32 "i"
#define PRIo32    __PRI32 "o"
#define PRIu32    __PRI32 "u"
#define PRIx32    __PRI32 "x"
#define PRIX32    __PRI32 "X"

#define PRId64    __PRI64 "d"
#define PRIi64    __PRI64 "i"
#define PRIo64    __PRI64 "o"
#define PRIu64    __PRI64 "u"
#define PRIx64    __PRI64 "x"
#define PRIX64    __PRI64 "X"

#define PRIdLEAST8   PRId8
#define PRIiLEAST8   PRIi8
#define PRIoLEAST8   PRIo8
#define PRIuLEAST8   PRIu8
#define PRIxLEAST8   PRIx8
#define PRIXLEAST8   PRIX8

#define PRIdLEAST16  PRId16
#define PRIiLEAST16  PRIi16
#define PRIoLEAST16  PRIo16
#define PRIuLEAST16  PRIu16
#define PRIxLEAST16  PRIx16
#define PRIXLEAST16  PRIX16

#define PRIdLEAST32  PRId32
#define PRIiLEAST32  PRIi32
#define PRIoLEAST32  PRIo32
#define PRIuLEAST32  PRIu32
#define PRIxLEAST32  PRIx32
#define PRIXLEAST32  PRIX32

#define PRIdLEAST64  PRId64
#define PRIiLEAST64  PRIi64
#define PRIoLEAST64  PRIo64
#define PRIuLEAST64  PRIu64
#define PRIxLEAST64  PRIx64
#define PRIXLEAST64  PRIX64

#define PRIdFAST8    PRIdLEAST8
#define PRIiFAST8    PRIiLEAST8
#define PRIoFAST8    PRIoLEAST8
#define PRIuFAST8    PRIuLEAST8
#define PRIxFAST8    PRIxLEAST8
#define PRIXFAST8    PRIXLEAST8

#define PRIdFAST16   PRIdLEAST16
#define PRIiFAST16   PRIiLEAST16
#define PRIoFAST16   PRIoLEAST16
#define PRIuFAST16   PRIuLEAST16
#define PRIxFAST16   PRIxLEAST16
#define PRIXFAST16   PRIXLEAST16

#define PRIdFAST32   PRIdLEAST32
#define PRIiFAST32   PRIiLEAST32
#define PRIoFAST32   PRIoLEAST32
#define PRIuFAST32   PRIuLEAST32
#define PRIxFAST32   PRIxLEAST32
#define PRIXFAST32   PRIXLEAST32

#define PRIdFAST64   PRIdLEAST64
#define PRIiFAST64   PRIiLEAST64
#define PRIoFAST64   PRIoLEAST64
#define PRIuFAST64   PRIuLEAST64
#define PRIxFAST64   PRIxLEAST64
#define PRIXFAST64   PRIXLEAST64

#if __SIZEOF_POINTER__ == 8
# define PRIdPTR  PRId64
# define PRIiPTR  PRIi64
# define PRIoPTR  PRIo64
# define PRIuPTR  PRIu64
# define PRIxPTR  PRIx64
# define PRIXPTR  PRIX64
#else
# define PRIdPTR  PRId32
# define PRIiPTR  PRIi32
# define PRIoPTR  PRIo32
# define PRIuPTR  PRIu32
# define PRIxPTR  PRIx32
# define PRIXPTR  PRIX32
#endif

#define PRIdMAX  PRId64
#define PRIiMAX  PRIi64
#define PRIoMAX  PRIo64
#define PRIuMAX  PRIu64
#define PRIxMAX  PRIx64
#define PRIXMAX  PRIX64

#define SCNd8   __PRI8 "d"
#define SCNi8   __PRI8 "i"
#define SCNo8   __PRI8 "o"
#define SCNu8   __PRI8 "u"
#define SCNx8   __PRI8 "x"

#define SCNd16  __PRI16 "d"
#define SCNi16  __PRI16 "i"
#define SCNo16  __PRI16 "o"
#define SCNu16  __PRI16 "u"
#define SCNx16  __PRI16 "x"

#define SCNd32  __PRI32 "d"
#define SCNi32  __PRI32 "i"
#define SCNo32  __PRI32 "o"
#define SCNu32  __PRI32 "u"
#define SCNx32  __PRI32 "x"

#define SCNd64  __PRI64 "d"
#define SCNi64  __PRI64 "i"
#define SCNo64  __PRI64 "o"
#define SCNu64  __PRI64 "u"
#define SCNx64  __PRI64 "x"

#define SCNdLEAST8   SCNd8
#define SCNiLEAST8   SCNi8
#define SCNoLEAST8   SCNo8
#define SCNuLEAST8   SCNu8
#define SCNxLEAST8   SCNx8

#define SCNdLEAST16  SCNd16
#define SCNiLEAST16  SCNi16
#define SCNoLEAST16  SCNo16
#define SCNuLEAST16  SCNu16
#define SCNxLEAST16  SCNx16

#define SCNdLEAST32  SCNd32
#define SCNiLEAST32  SCNi32
#define SCNoLEAST32  SCNo32
#define SCNuLEAST32  SCNu32
#define SCNxLEAST32  SCNx32

#define SCNdLEAST64  SCNd64
#define SCNiLEAST64  SCNi64
#define SCNoLEAST64  SCNo64
#define SCNuLEAST64  SCNu64
#define SCNxLEAST64  SCNx64

#define SCNdFAST8    SCNdLEAST8
#define SCNiFAST8    SCNiLEAST8
#define SCNoFAST8    SCNoLEAST8
#define SCNuFAST8    SCNuLEAST8
#define SCNxFAST8    SCNxLEAST8

#define SCNdFAST16   SCNdLEAST16
#define SCNiFAST16   SCNiLEAST16
#define SCNoFAST16   SCNoLEAST16
#define SCNuFAST16   SCNuLEAST16
#define SCNxFAST16   SCNxLEAST16

#define SCNdFAST32   SCNdLEAST32
#define SCNiFAST32   SCNiLEAST32
#define SCNoFAST32   SCNoLEAST32
#define SCNuFAST32   SCNuLEAST32
#define SCNxFAST32   SCNxLEAST32

#define SCNdFAST64   SCNdLEAST64
#define SCNiFAST64   SCNiLEAST64
#define SCNoFAST64   SCNoLEAST64
#define SCNuFAST64   SCNuLEAST64
#define SCNxFAST64   SCNxLEAST64

#if __SIZEOF_POINTER__ == 8
# define SCNdPTR  SCNd64
# define SCNiPTR  SCNi64
# define SCNoPTR  SCNo64
# define SCNuPTR  SCNu64
# define SCNxPTR  SCNx64
#else
# define SCNdPTR  SCNd32
# define SCNiPTR  SCNi32
# define SCNoPTR  SCNo32
# define SCNuPTR  SCNu32
# define SCNxPTR  SCNx32
#endif

#define SCNdMAX  SCNd64
#define SCNiMAX  SCNi64
#define SCNoMAX  SCNo64
#define SCNuMAX  SCNu64
#define SCNxMAX  SCNx64

#endif // STD_INTTYPES_H_
