mirror of
https://github.com/cuberite/libdeflate.git
synced 2025-09-10 12:58:30 -04:00
Depend on stdint.h instead of inttypes.h
stdint.h is better compatible with freestanding support as it can be compiled even if target platform lacks I/O capabilities. [EB - adjusted the include locations, and avoided breaking the build for old MSVC versions.]
This commit is contained in:
parent
27d5a74f03
commit
e2d1621e42
@ -47,9 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fixed-width integer types */
|
/* Fixed-width integer types */
|
||||||
#ifndef PRIu32
|
#include <stdint.h>
|
||||||
# include <inttypes.h>
|
|
||||||
#endif
|
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
typedef uint16_t u16;
|
typedef uint16_t u16;
|
||||||
typedef uint32_t u32;
|
typedef uint32_t u32;
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
* compiler_msc.h - definitions for the Microsoft C Compiler
|
* compiler_msc.h - definitions for the Microsoft C Compiler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h> /* for _byteswap_*() */
|
||||||
|
|
||||||
#define LIBEXPORT __declspec(dllexport)
|
#define LIBEXPORT __declspec(dllexport)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -22,24 +25,6 @@ typedef long long ssize_t;
|
|||||||
typedef int ssize_t;
|
typedef int ssize_t;
|
||||||
#endif
|
#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 <stdint.h>
|
|
||||||
#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 */
|
/* Assume a little endian architecture with fast unaligned access */
|
||||||
#define CPU_IS_LITTLE_ENDIAN() 1
|
#define CPU_IS_LITTLE_ENDIAN() 1
|
||||||
#define UNALIGNED_ACCESS_IS_FAST 1
|
#define UNALIGNED_ACCESS_IS_FAST 1
|
||||||
@ -52,7 +37,6 @@ typedef int ssize_t;
|
|||||||
#define forceinline __forceinline
|
#define forceinline __forceinline
|
||||||
|
|
||||||
/* Byte swap functions */
|
/* Byte swap functions */
|
||||||
#include <stdlib.h>
|
|
||||||
#define bswap16 _byteswap_ushort
|
#define bswap16 _byteswap_ushort
|
||||||
#define bswap32 _byteswap_ulong
|
#define bswap32 _byteswap_ulong
|
||||||
#define bswap64 _byteswap_uint64
|
#define bswap64 _byteswap_uint64
|
||||||
|
@ -48,6 +48,27 @@
|
|||||||
# define _printf(str_idx, args_idx)
|
# define _printf(str_idx, args_idx)
|
||||||
#endif
|
#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 <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user