diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 21:23:00 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 21:23:00 +0000 |
commit | 095e62b86fbd9568ddaae04aa8d15888b8487983 (patch) | |
tree | 559c824653a71369636148c75452fa1f7ae47b77 | |
parent | 92ccdfe95c7143871843ac0ddaa6e7b0e0f7061d (diff) | |
download | ovm-095e62b86fbd9568ddaae04aa8d15888b8487983.tar.gz ovm-095e62b86fbd9568ddaae04aa8d15888b8487983.tar.bz2 ovm-095e62b86fbd9568ddaae04aa8d15888b8487983.zip |
Introduced signed versions of common types
For each type T there is the signed version s_T
-rw-r--r-- | lib/base.h | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -28,16 +28,22 @@ #define VERBOSE 0 #endif -typedef uint64_t u64; +typedef uint8_t u8; +typedef int8_t i8; typedef uint32_t u32; typedef int32_t i32; +typedef uint64_t u64; typedef int64_t i64; + typedef float f32; typedef double f64; -typedef uint8_t byte; +typedef u8 byte; +typedef i8 s_byte; typedef u32 hword; +typedef i32 s_hword; typedef u64 word; +typedef i64 s_word; typedef union { @@ -59,8 +65,10 @@ typedef enum #define DWORD(WORD) ((data_t){.as_word = (WORD)}) #define WORD_SAFE_SUB(W, SUB) ((W) > (SUB) ? ((W) - (SUB)) : 0) -#define HWORD_SIZE sizeof(hword) -#define WORD_SIZE sizeof(word) +#define HWORD_SIZE sizeof(hword) +#define SHWORD_SIZE sizeof(s_hword) +#define WORD_SIZE sizeof(word) +#define SWORD_SIZE sizeof(s_word) // Macros to extract the nth byte or nth hword from a word #define WORD_NTH_BYTE(WORD, N) (((WORD) >> ((N)*8)) & 0xff) |