aboutsummaryrefslogtreecommitdiff
path: root/src/real_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/real_mode')
-rw-r--r--src/real_mode/mod.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/real_mode/mod.rs b/src/real_mode/mod.rs
index 13b3ba0..8b33093 100644
--- a/src/real_mode/mod.rs
+++ b/src/real_mode/mod.rs
@@ -6089,12 +6089,15 @@ fn read_M<
#[inline]
fn width_to_gp_reg_bank(width: u8) -> RegisterBank {
- match width {
- 1 => return RegisterBank::B,
- 2 => return RegisterBank::W,
- 4 => return RegisterBank::D,
- _ => unsafe { unreachable_unchecked(); }
- }
+ let index = width.trailing_zeros();
+
+ const BANK_LUT: [RegisterBank; 3] = [
+ RegisterBank::B,
+ RegisterBank::W,
+ RegisterBank::D,
+ ];
+
+ *BANK_LUT.get(index as usize).unwrap_or_else(|| unsafe { unreachable_unchecked() })
}
fn read_0f_opcode(opcode: u8, prefixes: &mut Prefixes) -> OpcodeRecord {