Add portable way of formatting khint_t type (from klib)

This commit is contained in:
Iestyn Pryce
2017-05-21 11:58:37 +01:00
parent d8239a9cc4
commit 87cf7b5bca
2 changed files with 6 additions and 2 deletions

View File

@@ -101,14 +101,18 @@ int main() {
#if UINT_MAX == 0xffffffffu
typedef unsigned int khint32_t;
#define PRIkh32 "u"
#elif ULONG_MAX == 0xffffffffu
typedef unsigned long khint32_t;
#define PRIkh32 "lu"
#endif
#if ULONG_MAX == ULLONG_MAX
typedef unsigned long khint64_t;
#define PRIkh64 "lu"
#else
typedef unsigned long long khint64_t;
#define PRIkh64 "llu"
#endif
#ifndef kh_inline