From c5896689cf06d562a03ae9a1ae1373acd52cc715 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 26 Sep 2024 23:57:03 -0600 Subject: [PATCH] Use ppc750cl Opcode::from --- objdiff-core/src/arch/ppc.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/objdiff-core/src/arch/ppc.rs b/objdiff-core/src/arch/ppc.rs index 67f426a..16da741 100644 --- a/objdiff-core/src/arch/ppc.rs +++ b/objdiff-core/src/arch/ppc.rs @@ -194,9 +194,7 @@ impl ObjArch for ObjArchPpc { return Some(DataType::String); } - // SAFETY: ppc750cl::Opcode is repr(u8) and op is originally obtained on PPC from casting - // an Opcode to a u8 so we know it's a valid value for Opcode. - match unsafe { std::mem::transmute::(instruction.op as u8) } { + match Opcode::from(instruction.op as u8) { Opcode::Lbz | Opcode::Lbzu | Opcode::Lbzux | Opcode::Lbzx => Some(DataType::Int8), Opcode::Lhz | Opcode::Lhzu | Opcode::Lhzux | Opcode::Lhzx => Some(DataType::Int16), Opcode::Lha | Opcode::Lhau | Opcode::Lhaux | Opcode::Lhax => Some(DataType::Int16),