summaryrefslogtreecommitdiff
path: root/source/base/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/base/base.h')
-rwxr-xr-xsource/base/base.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/source/base/base.h b/source/base/base.h
new file mode 100755
index 0000000..3fe9dca
--- /dev/null
+++ b/source/base/base.h
@@ -0,0 +1,64 @@
1#ifndef BASE_H
2#define BASE_H
3
4/* assert an expression and output the file and the line */
5#define internal static
6#define global_variable static
7#define local_persist static
8
9#define unused(x) (void)(x)
10#define NIL 0
11
12#define DEPRECATED __attribute__((__deprecated__))
13
14#if defined(__arm__) || defined(__aarch64__)
15#define breakpoint __asm__ volatile("brk #0");
16#define temp_breakpoint __asm__ volatile("udf #0");
17#elif defined(__i386__) || defined(__x86_64__)
18#define breakpoint __asm__ volatile("int3");
19#endif
20
21#define MemCpy(dest, src, len) memcpy((dest), (src), (len))
22#define MemSet(dest, len) memset((dest), (0), (len))
23
24#if COMPILER_MSVC || (COMPILER_CLANG && OS_WINDOWS)
25#pragma section(".rdata$", read)
26#define read_only __declspec(allocate(".rdata$"))
27#elif (COMPILER_CLANG && OS_LINUX)
28#define read_only __attribute__((section(".rodata")))
29#else
30#define read_only
31#endif
32
33typedef uint64_t u64;
34typedef uint32_t u32;
35typedef uint16_t u16;
36typedef uint8_t u8;
37
38typedef int8_t s8;
39typedef int16_t s16;
40typedef int32_t s32;
41typedef int64_t s64;
42
43typedef float f32;
44typedef double f64;
45
46typedef s32 b32;
47typedef s16 b16;
48typedef s8 b8;
49
50typedef uintptr_t umm;
51typedef intptr_t smm;
52
53#define True (1 == 1)
54#define False (1 != 1)
55
56#define Red "\x1b[31m"
57#define Green "\x1b[32m"
58#define Reset "\x1b[0m"
59#define Blue "\x1b[34m"
60#define Yellow "\x1b[33m"
61
62#define Len(s) (sizeof(s) - 1)
63
64#endif