Add a couple more cast macros
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user