From 0c8ad22d45ea74b1687cc3b6f452c5a0939873a5 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 12 Sep 2024 08:37:46 -0400 Subject: big endian --- include/mips.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'include/mips.h') 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[] = { -- cgit v1.2.3-freya