diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2021-08-05 20:10:07 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2021-08-05 20:13:07 +0100 |
commit | 7e7bdc19e76a5f87bccf7a84872f8d45295ee5b7 (patch) | |
tree | 226c43176517f7f3dc30e3d67862449cef0c7d16 /common.h | |
parent | 07ed3ac992d5086dcd47273236ad72e496d9620f (diff) | |
download | pack-7e7bdc19e76a5f87bccf7a84872f8d45295ee5b7.tar.gz pack-7e7bdc19e76a5f87bccf7a84872f8d45295ee5b7.tar.xz pack-7e7bdc19e76a5f87bccf7a84872f8d45295ee5b7.zip |
Define PRIuSIZE to avoid issues compiling with msvcrt
On windows and when cross compiling with mingw the standard library only
supports C89 which means that print format arguments cannot take "%zu".
To fix this, a PRIuSIZE macros is needed which expands to PRIu32 on
windows 32 bit and PRIu64 on windows 64 bit.
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,18 @@ #define BITMASK(n) (UINTMAX_MAX >> (sizeof (uintmax_t) * CHAR_BIT - n)) +#ifndef PRIuSIZE + #ifdef _WIN32 + #ifdef _WIN64 + #define PRIuSIZE PRIu64 + #else + #define PRIuSIZE PRIu32 + #endif + #else + #define PRIuSIZE "zu" + #endif +#endif + enum endian { BIG, LITTLE }; size_t getsize(char c); |