aboutsummaryrefslogtreecommitdiffstats
path: root/src/shorthand.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-06-02 17:26:08 +0200
committerBad Diode <bd@badd10de.dev>2021-06-02 17:26:08 +0200
commitf6686f1e86927f038086023362251ebe78ce5ad6 (patch)
treed196fc1c32c55442a2ac75d4ce046b1c0e0d6d48 /src/shorthand.h
downloadstepper-f6686f1e86927f038086023362251ebe78ce5ad6.tar.gz
stepper-f6686f1e86927f038086023362251ebe78ce5ad6.zip
Init repo with basic BG framebuffer renderer
Diffstat (limited to 'src/shorthand.h')
-rw-r--r--src/shorthand.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/shorthand.h b/src/shorthand.h
new file mode 100644
index 0000000..08cc7fe
--- /dev/null
+++ b/src/shorthand.h
@@ -0,0 +1,47 @@
1/*
2Copyright (c) 2021 Bad Diode
3
4Permission to use, copy, modify, and distribute this software for any
5purpose with or without fee is hereby granted, provided that the above
6copyright notice and this permission notice appear in all copies.
7
8THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9WITH REGARD TO THIS SOFTWARE.
10*/
11
12#ifndef UTILS_SHORTHAND_H
13#define UTILS_SHORTHAND_H
14
15#include <assert.h>
16#include <stdbool.h>
17#include <stddef.h>
18#include <stdint.h>
19
20//
21// This simple header just typedefs the basic C define types to a shorter name,
22// loads the quality of life bool macro for _Bool and defines shorthand macros
23// for byte sizes.
24
25typedef uint8_t u8;
26typedef uint16_t u16;
27typedef uint32_t u32;
28typedef uint64_t u64;
29typedef int8_t s8;
30typedef int16_t s16;
31typedef int32_t s32;
32typedef int64_t s64;
33typedef volatile u8 vu8;
34typedef volatile u16 vu16;
35typedef volatile u32 vu32;
36typedef volatile u64 vu64;
37typedef volatile s8 vs8;
38typedef volatile s16 vs16;
39typedef volatile s32 vs32;
40typedef volatile s64 vs64;
41
42#define KB(N) ((u64)(N) * 1024)
43#define MB(N) ((u64)KB(N) * 1024)
44#define GB(N) ((u64)MB(N) * 1024)
45#define TB(N) ((u64)GB(N) * 1024)
46
47#endif // UTILS_SHORTHAND_H