diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 33749d440..1c4c4790c 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -79,6 +79,15 @@ #define BCD16(x) ((((x) / 1000) << 12) | (((x) / 100) << 8) | BCD8(x)) #define BCD32(x) ((((x) / 10000000) << 28) | (((x) / 1000000) << 24) | (((x) / 100000) << 20) | (((x) / 10000) << 16) | BCD16(x)) +#define AS_U8(x) (*((uint8_t *) &(x))) +#define AS_U16(x) (*((uint16_t *) &(x))) +#define AS_U32(x) (*((uint32_t *) &(x))) +#define AS_U64(x) (*((uint64_t *) &(x))) +#define AS_I8(x) (*((int8_t *) &(x))) +#define AS_I16(x) (*((int16_t *) &(x))) +#define AS_I32(x) (*((int32_t *) &(x))) +#define AS_I64(x) (*((int64_t *) &(x))) + #if defined(__GNUC__) || defined(__clang__) # define UNLIKELY(x) __builtin_expect((x), 0) # define LIKELY(x) __builtin_expect((x), 1)