Added constant ROW_WIDTH to decode_register

This commit is contained in:
Abdelrahman Said 2023-03-05 14:02:42 +00:00
parent d4733b7be7
commit 0efaa69327

View File

@ -111,8 +111,10 @@ void decode_register(uint16_t instruction, bool word, char *dest) {
}; };
// clang-format on // clang-format on
static const uint16_t ROW_WIDTH = 2;
uint16_t offset = instruction & reg_mask; uint16_t offset = instruction & reg_mask;
// Multiply offset by 2 since each row has 2 columns // Multiply offset by 2 since each row has 2 columns
strcpy(dest, table[offset * 2 + (uint16_t)word]); strcpy(dest, table[offset * ROW_WIDTH + (uint16_t)word]);
} }