diff --git a/common/common_defs.h b/common/common_defs.h index 8062308..4517abb 100644 --- a/common/common_defs.h +++ b/common/common_defs.h @@ -47,9 +47,7 @@ #endif /* Fixed-width integer types */ -#ifndef PRIu32 -# include -#endif +#include typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; diff --git a/common/compiler_msc.h b/common/compiler_msc.h index 0b40d3f..18cfa12 100644 --- a/common/compiler_msc.h +++ b/common/compiler_msc.h @@ -2,6 +2,9 @@ * compiler_msc.h - definitions for the Microsoft C Compiler */ +#include +#include /* for _byteswap_*() */ + #define LIBEXPORT __declspec(dllexport) /* @@ -22,24 +25,6 @@ typedef long long ssize_t; typedef int ssize_t; #endif -/* - * Old versions (e.g. VS2010) of MSC have stdint.h but not the C99 header - * inttypes.h. Work around this by defining the PRI* macros ourselves. - */ -#include -#define PRIu8 "hhu" -#define PRIu16 "hu" -#define PRIu32 "u" -#define PRIu64 "llu" -#define PRIi8 "hhi" -#define PRIi16 "hi" -#define PRIi32 "i" -#define PRIi64 "lli" -#define PRIx8 "hhx" -#define PRIx16 "hx" -#define PRIx32 "x" -#define PRIx64 "llx" - /* Assume a little endian architecture with fast unaligned access */ #define CPU_IS_LITTLE_ENDIAN() 1 #define UNALIGNED_ACCESS_IS_FAST 1 @@ -52,7 +37,6 @@ typedef int ssize_t; #define forceinline __forceinline /* Byte swap functions */ -#include #define bswap16 _byteswap_ushort #define bswap32 _byteswap_ulong #define bswap64 _byteswap_uint64 diff --git a/programs/prog_util.h b/programs/prog_util.h index 71f7160..bfab2cf 100644 --- a/programs/prog_util.h +++ b/programs/prog_util.h @@ -48,6 +48,27 @@ # define _printf(str_idx, args_idx) #endif +#ifdef _MSC_VER +/* + * Old versions (e.g. VS2010) of MSC have stdint.h but not the C99 header + * inttypes.h. Work around this by defining the PRI* macros ourselves. + */ +# define PRIu8 "hhu" +# define PRIu16 "hu" +# define PRIu32 "u" +# define PRIu64 "llu" +# define PRIi8 "hhi" +# define PRIi16 "hi" +# define PRIi32 "i" +# define PRIi64 "lli" +# define PRIx8 "hhx" +# define PRIx16 "hx" +# define PRIx32 "x" +# define PRIx64 "llx" +#else +# include +#endif + #ifdef _WIN32 /*