aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/common/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/common/types.h')
-rw-r--r--src/libjin/common/types.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libjin/common/types.h b/src/libjin/common/types.h
new file mode 100644
index 0000000..e31ce5e
--- /dev/null
+++ b/src/libjin/common/types.h
@@ -0,0 +1,34 @@
+#ifndef __JE_TYPES_H__
+#define __JE_TYPES_H__
+#include <stdint.h>
+#include <stdlib.h>
+#include <cstring>
+
+namespace JinEngine
+{
+
+ typedef int8_t int8; ///< Signed integer with a size of 8 bits. Supports values from -128 to 127
+ typedef uint8_t uint8; ///< Unsigned integer with a size of 8 bits. Supports values from 0 to 255.
+ typedef uint8 byte; ///< Unsigned integer with 8 bits (1 byte). Supports 256 values from 0 to 255.
+ typedef int16_t int16; ///< Signed integer with a size of 16 bits. Supports values from -32768 to 32767
+ typedef uint16_t uint16; ///< Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
+ typedef int32_t int32; ///< Signed integer with a size of 32 bits. Supports values from -2147483648 to 2147483647.
+ typedef uint32_t uint32; ///< Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1).
+ typedef int64_t int64; ///< Signed integer with a size of 64 bits. Supports values from -(2^63) to (2^63 - 1).
+ typedef uint64_t uint64; ///< Unsigned integer with a size of 64 bits, Supports values from 0 to (2^64 - 1).
+
+ typedef uint32_t uint;
+ typedef int32_t sint;
+
+#define Union(name, ...) \
+union _Ctor{ \
+ _Ctor() { memset(this, 0, sizeof(*this)); } \
+ __VA_ARGS__; \
+} name;
+
+#define Struct(name, ...) \
+struct {__VA_ARGS__;} name;
+
+}
+
+#endif \ No newline at end of file