aboutsummaryrefslogtreecommitdiffstats
path: root/src/shorthand.h
blob: 42eb9350b0d989afd6396d316d167bedb38ad7fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef UTILS_SHORTHAND_H
#define UTILS_SHORTHAND_H

#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

//
// This simple header just typedefs the basic C define types to a shorter name,
// loads the quality of life bool macro for _Bool and defines shorthand macros
// for byte sizes.

typedef uint8_t      u8;
typedef uint16_t     u16;
typedef uint32_t     u32;
typedef uint64_t     u64;
typedef int8_t       s8;
typedef int16_t      s16;
typedef int32_t      s32;
typedef int64_t      s64;
typedef volatile u8  vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8  vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;

#define KB(N) ((u64)(N)   * 1024)
#define MB(N) ((u64)KB(N) * 1024)
#define GB(N) ((u64)MB(N) * 1024)
#define TB(N) ((u64)GB(N) * 1024)

#endif // UTILS_SHORTHAND_H