From 858315e264602b19fdde96800bd9d391cab2202a Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 20 Oct 2019 15:25:58 -0700 Subject: that terrifying code is no longer an improvement --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index fa22629..a8eb01d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2440,10 +2440,10 @@ pub fn read_instr>(mut bytes_iter: T, instruction: &mut Ins match bytes_iter.next() { Some(b) => { instruction.length += 1; - let record: u16 = (unsafe { std::mem::transmute::<&'static [OpcodeRecord], &'static [u16]>(&OPCODES[..]) })[b as usize]; - if let Interpretation::Instruction(opcode) = (unsafe { std::mem::transmute::(record) }).0 { + let record = OPCODES[b as usize]; + if let Interpretation::Instruction(opcode) = record.0 { instruction.opcode = opcode; - break unsafe { std::mem::transmute::(record) }; + break record; } else { match b { x if (x & 0xf0 == 0x40) => { -- cgit v1.1