summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2016-10-04 17:59:20 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2016-10-04 18:09:01 -0700
commit4b189f89d05cd62f7fc17e6ebcd011165f767a22 (patch)
tree15e91ec7adbe1aabdcb0c14625447ae2b7b55a1f /include
parent2024ae60d683dea2ee800e4b482ef840a510cf62 (diff)
downloadnasm-4b189f89d05cd62f7fc17e6ebcd011165f767a22.tar.gz
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 <hpa@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/nasmint.h22
1 files 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 <limits.h>
-/*** 64-bit type: long or long long ***/
+/*** 64-bit type: __int64, long or long long ***/
/* Some old versions of gcc <limits.h> 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;