aboutsummaryrefslogtreecommitdiffstats
path: root/src/shorthand.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-18 16:40:24 +0200
committerBad Diode <bd@badd10de.dev>2021-05-18 16:40:24 +0200
commit0c7265cf0de9d4ec95d28c5e103c00a63f4a1697 (patch)
tree4a1145e849e078395430a8d718c4bd69a06fb29f /src/shorthand.h
downloaduxngba-0c7265cf0de9d4ec95d28c5e103c00a63f4a1697.tar.gz
uxngba-0c7265cf0de9d4ec95d28c5e103c00a63f4a1697.zip
Proof of concept of UXN on the GBA
Diffstat (limited to 'src/shorthand.h')
-rw-r--r--src/shorthand.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/shorthand.h b/src/shorthand.h
new file mode 100644
index 0000000..42eb935
--- /dev/null
+++ b/src/shorthand.h
@@ -0,0 +1,36 @@
1#ifndef UTILS_SHORTHAND_H
2#define UTILS_SHORTHAND_H
3
4#include <assert.h>
5#include <stdbool.h>
6#include <stddef.h>
7#include <stdint.h>
8
9//
10// This simple header just typedefs the basic C define types to a shorter name,
11// loads the quality of life bool macro for _Bool and defines shorthand macros
12// for byte sizes.
13
14typedef uint8_t u8;
15typedef uint16_t u16;
16typedef uint32_t u32;
17typedef uint64_t u64;
18typedef int8_t s8;
19typedef int16_t s16;
20typedef int32_t s32;
21typedef int64_t s64;
22typedef volatile u8 vu8;
23typedef volatile u16 vu16;
24typedef volatile u32 vu32;
25typedef volatile u64 vu64;
26typedef volatile s8 vs8;
27typedef volatile s16 vs16;
28typedef volatile s32 vs32;
29typedef volatile s64 vs64;
30
31#define KB(N) ((u64)(N) * 1024)
32#define MB(N) ((u64)KB(N) * 1024)
33#define GB(N) ((u64)MB(N) * 1024)
34#define TB(N) ((u64)GB(N) * 1024)
35
36#endif // UTILS_SHORTHAND_H