Added constant ROW_WIDTH to decode_register
This commit is contained in:
parent
d4733b7be7
commit
0efaa69327
@ -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]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user