aboutsummaryrefslogtreecommitdiff
path: root/include/bh/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/bh/platform.h')
-rw-r--r--include/bh/platform.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/bh/platform.h b/include/bh/platform.h
new file mode 100644
index 0000000..c48149c
--- /dev/null
+++ b/include/bh/platform.h
@@ -0,0 +1,46 @@
+#ifndef BHLIB_PLATFORM_H
+#define BHLIB_PLATFORM_H
+
+#include <stddef.h>
+
+/* Common type definitions */
+typedef signed char bh_int8_t;
+typedef unsigned char bh_uint8_t;
+typedef signed short bh_int16_t;
+typedef unsigned short bh_uint16_t;
+typedef float bh_float32_t;
+typedef double bh_float64_t;
+
+/* Platform specific type definition */
+#if __STDC_VERSION__ >= 199901L || defined(__GNUC__)
+#include <stdint.h>
+
+typedef int32_t bh_int32_t;
+typedef uint32_t bh_uint32_t;
+typedef int64_t bh_int64_t;
+typedef uint64_t bh_uint64_t;
+typedef intptr_t bh_intptr_t;
+typedef uintptr_t bh_uintptr_t;
+
+#elif defined(_WIN32)
+typedef __int32 bh_int32_t;
+typedef unsigned __int32 bh_uint32_t;
+typedef __int64 bh_int64_t;
+typedef unsigned __int64 bh_uint64_t;
+
+#if defined(_WIN64)
+typedef __int64 bh_intptr_t;
+typedef unsigned __int64 bh_uintptr_t;
+#else
+typedef __int32 bh_intptr_t;
+typedef unsigned __int32 bh_uintptr_t;
+#endif
+
+#else
+
+#error "Unsupported platform"
+#endif
+
+typedef bh_int64_t bh_off_t;
+
+#endif /* BHLIB_PLATFORM_H */