aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bin2carr/src/shorthand.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-22 23:17:50 +0200
committerBad Diode <bd@badd10de.dev>2021-05-22 23:17:50 +0200
commit97d1c4246e167ab493175d890409c4154628760c (patch)
tree41e9b05c3e4a890cb7e8491d55173dcd84964ab8 /tools/bin2carr/src/shorthand.h
parentefbee96caa1452486a007eeeabb5073aa9025dae (diff)
downloaduxngba-97d1c4246e167ab493175d890409c4154628760c.tar.gz
uxngba-97d1c4246e167ab493175d890409c4154628760c.zip
Include bin2carr on the tools directory
Diffstat (limited to 'tools/bin2carr/src/shorthand.h')
-rw-r--r--tools/bin2carr/src/shorthand.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/bin2carr/src/shorthand.h b/tools/bin2carr/src/shorthand.h
new file mode 100644
index 0000000..9c2e2f0
--- /dev/null
+++ b/tools/bin2carr/src/shorthand.h
@@ -0,0 +1,35 @@
1#ifndef MIC_SHORTHAND_H
2#define MIC_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. We need that the targeted architecture uses the floating
13// point representation as described on the IEEE-754 standard.
14//
15
16_Static_assert(sizeof(double) == 8, "no support for IEEE-754");
17_Static_assert(sizeof(float) == 4, "no support for IEEE-754");
18
19typedef uint8_t u8;
20typedef uint16_t u16;
21typedef uint32_t u32;
22typedef uint64_t u64;
23typedef int8_t s8;
24typedef int16_t s16;
25typedef int32_t s32;
26typedef int64_t s64;
27typedef float f32;
28typedef double f64;
29
30#define KB(N) ((u64)(N) * 1024)
31#define MB(N) ((u64)KB(N) * 1024)
32#define GB(N) ((u64)MB(N) * 1024)
33#define TB(N) ((u64)GB(N) * 1024)
34
35#endif // MIC_SHORTHAND_H