aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-10-20 15:25:58 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit858315e264602b19fdde96800bd9d391cab2202a (patch)
tree4d0aaabe4b40ca3b9f90705f9b9400f885245af1
parente5d46b89d95a0e1c1c3a7e112a9b36bb82163b2d (diff)
that terrifying code is no longer an improvement
-rw-r--r--src/lib.rs6
1 files changed, 3 insertions, 3 deletions
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<T: Iterator<Item=u8>>(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::<u16, OpcodeRecord>(record) }).0 {
+ let record = OPCODES[b as usize];
+ if let Interpretation::Instruction(opcode) = record.0 {
instruction.opcode = opcode;
- break unsafe { std::mem::transmute::<u16, OpcodeRecord>(record) };
+ break record;
} else {
match b {
x if (x & 0xf0 == 0x40) => {