aboutsummaryrefslogtreecommitdiffstats
path: root/src/shorthand.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shorthand.h')
-rw-r--r--src/shorthand.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/shorthand.h b/src/shorthand.h
new file mode 100644
index 0000000..0897824
--- /dev/null
+++ b/src/shorthand.h
@@ -0,0 +1,46 @@
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 <stdbool.h>
16#include <stddef.h>
17#include <stdint.h>
18
19//
20// This simple header just typedefs the basic C define types to a shorter name,
21// loads the quality of life bool macro for _Bool and defines shorthand macros
22// for byte sizes.
23
24typedef uint8_t u8;
25typedef uint16_t u16;
26typedef uint32_t u32;
27typedef uint64_t u64;
28typedef int8_t s8;
29typedef int16_t s16;
30typedef int32_t s32;
31typedef int64_t s64;
32typedef volatile u8 vu8;
33typedef volatile u16 vu16;
34typedef volatile u32 vu32;
35typedef volatile u64 vu64;
36typedef volatile s8 vs8;
37typedef volatile s16 vs16;
38typedef volatile s32 vs32;
39typedef volatile s64 vs64;
40
41#define KB(N) ((u64)(N) * 1024)
42#define MB(N) ((u64)KB(N) * 1024)
43#define GB(N) ((u64)MB(N) * 1024)
44#define TB(N) ((u64)GB(N) * 1024)
45
46#endif // UTILS_SHORTHAND_H