Split OPCODE_IS_TYPE -> SIGNED|UNSIGNED
Due to reordering I need to have two macros for checking if an opcode is of a type. If the type is signed then the upper bound must be OP_<type>_LONG whereas if it is unsigned then the upper bound must be OP_<type>_WORD.
This commit is contained in:
10
lib/inst.h
10
lib/inst.h
@@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
const char *opcode_as_cstr(opcode_t);
|
const char *opcode_as_cstr(opcode_t);
|
||||||
|
|
||||||
#define OPCODE_IS_TYPE(OPCODE, OP_TYPE) \
|
#define UNSIGNED_OPCODE_IS_TYPE(OPCODE, OP_TYPE) \
|
||||||
(((OPCODE) >= OP_TYPE##_BYTE) && ((OPCODE) <= OP_TYPE##_WORD))
|
(((OPCODE) >= OP_TYPE##_BYTE) && ((OPCODE) <= OP_TYPE##_WORD))
|
||||||
|
|
||||||
#define OPCODE_DATA_TYPE(OPCODE, OP_TYPE) \
|
#define SIGNED_OPCODE_IS_TYPE(OPCODE, OP_TYPE) \
|
||||||
((OPCODE) == OP_TYPE##_BYTE ? DATA_TYPE_BYTE \
|
(((OPCODE) >= OP_TYPE##_BYTE) && ((OPCODE) <= OP_TYPE##_LONG))
|
||||||
: ((OPCODE) == OP_TYPE##_HWORD) ? DATA_TYPE_HWORD \
|
|
||||||
: DATA_TYPE_WORD)
|
#define OPCODE_DATA_TYPE(OPCODE, OP_TYPE) (OPCODE - OP_TYPE##_BYTE)
|
||||||
|
|
||||||
// OPCODE_DATA_TYPE: opcode_t -> data_type_t. data_type_t acts as
|
// OPCODE_DATA_TYPE: opcode_t -> data_type_t. data_type_t acts as
|
||||||
// a map between types and their offsets from the first type of
|
// a map between types and their offsets from the first type of
|
||||||
|
|||||||
Reference in New Issue
Block a user