riscv/
.clang-format
570 B
.gitignore
5 B
.gitsigners
112 B
LICENSE
1.1 KiB
Makefile
1.1 KiB
README
3.3 KiB
color.h
567 B
emulator.c
79.7 KiB
io.c
1.1 KiB
io.h
444 B
jit.c
32.6 KiB
jit.h
5.0 KiB
riscv.c
12.0 KiB
riscv.h
12.0 KiB
types.h
1.0 KiB
types.h
raw
| 1 | #ifndef TYPES_H |
| 2 | #define TYPES_H |
| 3 | |
| 4 | typedef unsigned char u8; |
| 5 | typedef unsigned short u16; |
| 6 | typedef unsigned int u32; |
| 7 | typedef unsigned long long u64; |
| 8 | typedef signed char i8; |
| 9 | typedef short i16; |
| 10 | typedef int i32; |
| 11 | typedef long long i64; |
| 12 | typedef float f32; |
| 13 | typedef double f64; |
| 14 | |
| 15 | typedef unsigned long usize; |
| 16 | typedef long isize; |
| 17 | |
| 18 | typedef u8 bool; |
| 19 | |
| 20 | #define true 1 |
| 21 | #define false 0 |
| 22 | |
| 23 | #ifndef NULL |
| 24 | #define NULL ((void *)0) |
| 25 | #endif |
| 26 | |
| 27 | #define U8_MIN 0 |
| 28 | #define U8_MAX 255 |
| 29 | #define U16_MIN 0 |
| 30 | #define U16_MAX 65535 |
| 31 | #define U32_MIN 0 |
| 32 | #define U32_MAX 4294967295U |
| 33 | |
| 34 | #define I8_MIN (-128) |
| 35 | #define I8_MAX 127 |
| 36 | #define I16_MIN (-32768) |
| 37 | #define I16_MAX 32767 |
| 38 | #define I32_MIN -2147483648 |
| 39 | #define I32_MAX 2147483647 |
| 40 | |
| 41 | /* Use appropriate syntax for no-discard function attribute, depending |
| 42 | * on C standard used. */ |
| 43 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L |
| 44 | #define __nodiscard [[nodiscard]] |
| 45 | #else |
| 46 | #define __nodiscard __attribute__((warn_unused_result)) |
| 47 | #endif |
| 48 | |
| 49 | #endif |