diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mips.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/mips.h b/include/mips.h index 1233693..ff043cd 100644 --- a/include/mips.h +++ b/include/mips.h @@ -159,6 +159,14 @@ struct mips_instruction_branch_data { uint32_t op : 6; } __attribute__((packed)); +union mips_instruction_data { + uint32_t raw; + struct mips_instruction_r_data R; + struct mips_instruction_i_data I; + struct mips_instruction_j_data J; + struct mips_instruction_branch_data B; +} __attribute__((packed)); + /* mips instruction information */ struct mips_instruction { // metadata @@ -167,13 +175,7 @@ struct mips_instruction { const char *name; // data - union { - uint32_t data; - struct mips_instruction_r_data R_data; - struct mips_instruction_i_data I_data; - struct mips_instruction_j_data J_data; - struct mips_instruction_branch_data B_data; - } __attribute__((packed)); + union mips_instruction_data data; }; @@ -182,7 +184,7 @@ struct mips_instruction { MIPS_INS_ ##ins, \ MIPS_FORMAT_ ##format, \ #ins, \ - .format##_data = { __VA_ARGS__ } \ + .data = { .format = { __VA_ARGS__ } } \ }, \ static const struct mips_instruction mips_instructions[] = { |