Add a couple more cast macros

This commit is contained in:
RichardG867
2025-09-20 11:20:33 -03:00
parent 7c25ca22e3
commit cfa00e9e55

View File

@@ -79,14 +79,16 @@
#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)))
#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)))
#define AS_FLOAT(x) (*((float *) &(x)))
#define AS_DOUBLE(x) (*((double *) &(x)))
#if defined(__GNUC__) || defined(__clang__)
# define UNLIKELY(x) __builtin_expect((x), 0)