From 4b189f89d05cd62f7fc17e6ebcd011165f767a22 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 4 Oct 2016 17:59:20 -0700 Subject: [PATCH] nasmint.h: add support for the MSVS < 2005 __int64 type MSVS < 2005 doesn't have "long long", so use the MSVC-specific __int64, I64, and ...[u]i64 constructs. nasmint.h makes this easy enough that it is worth doing. Signed-off-by: H. Peter Anvin --- include/nasmint.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/nasmint.h b/include/nasmint.h index e353aa93..9bb935cf 100644 --- a/include/nasmint.h +++ b/include/nasmint.h @@ -14,7 +14,7 @@ #include -/*** 64-bit type: long or long long ***/ +/*** 64-bit type: __int64, long or long long ***/ /* Some old versions of gcc omit LLONG_MAX */ #ifndef LLONG_MAX @@ -25,7 +25,25 @@ # endif #endif -#if LONG_MAX == 9223372036854775807L +#ifndef _I64_MAX +# ifdef _MSC_VER +# define _I64_MAX 9223372036854775807 +# else +# define _I64_MAX 0 +# endif +#endif + +#if _I64_MAX == 9223372036854775807 + +/* Windows-based compiler: use __int64 */ +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#define _scn64 "I64" +#define _pri64 "I64" +#define INT64_C(x) x ## i64 +#define UINT64_C(x) x ## ui64 + +#elif LONG_MAX == 9223372036854775807L /* long is 64 bits */ typedef signed long int64_t; -- 2.11.4.GIT