summaryrefslogtreecommitdiffstats
path: root/omni/stdint.h
diff options
context:
space:
mode:
Diffstat (limited to 'omni/stdint.h')
-rw-r--r--omni/stdint.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/omni/stdint.h b/omni/stdint.h
new file mode 100644
index 0000000..088b584
--- /dev/null
+++ b/omni/stdint.h
@@ -0,0 +1,58 @@
+#ifndef OMNI_INT_H
+#define OMNI_INT_H
+
+#include <stdint.h>
+
+#include "omni/platform.h"
+
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
+typedef int8_t i8;
+typedef int16_t i16;
+typedef int32_t i32;
+typedef int64_t i64;
+
+typedef float f32;
+typedef double f64;
+
+#define U8_MAX UINT8_MAX
+#define U16_MAX UINT16_MAX
+#define U32_MAX UINT32_MAX
+#define U64_MAX UINT64_MAX
+
+#define I8_MIN INT8_MIN
+#define I16_MIN INT16_MIN
+#define I32_MIN INT32_MIN
+#define I64_MIN INT64_MIN
+
+#define I8_MAX INT8_MAX
+#define I16_MAX INT16_MAX
+#define I32_MAX INT32_MAX
+#define I64_MAX INT64_MAX
+
+#if OMNI_ARCH_64BIT
+typedef u64 usize;
+typedef i64 isize;
+
+#define USIZE_MAX UINT64_MAX
+
+#define ISIZE_MIN INT64_MIN
+#define ISIZE_MAX INT64_MAX
+
+#elif OMNI_ARCH_32BIT
+typedef u32 usize;
+typedef i32 isize;
+
+#define USIZE_MAX UINT32_MAX
+
+#define ISIZE_MIN INT32_MIN
+#define ISIZE_MAX INT32_MAX
+
+#else
+#error "target is not supported"
+#endif
+
+#endif