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;