Use ppc750cl Opcode::from

This commit is contained in:
Luke Street 2024-09-26 23:57:03 -06:00
parent 67719dd93e
commit c5896689cf
1 changed files with 1 additions and 3 deletions

View File

@ -194,9 +194,7 @@ impl ObjArch for ObjArchPpc {
return Some(DataType::String); return Some(DataType::String);
} }
// SAFETY: ppc750cl::Opcode is repr(u8) and op is originally obtained on PPC from casting match Opcode::from(instruction.op as u8) {
// an Opcode to a u8 so we know it's a valid value for Opcode.
match unsafe { std::mem::transmute::<u8, Opcode>(instruction.op as u8) } {
Opcode::Lbz | Opcode::Lbzu | Opcode::Lbzux | Opcode::Lbzx => Some(DataType::Int8), Opcode::Lbz | Opcode::Lbzu | Opcode::Lbzux | Opcode::Lbzx => Some(DataType::Int8),
Opcode::Lhz | Opcode::Lhzu | Opcode::Lhzux | Opcode::Lhzx => Some(DataType::Int16), Opcode::Lhz | Opcode::Lhzu | Opcode::Lhzux | Opcode::Lhzx => Some(DataType::Int16),
Opcode::Lha | Opcode::Lhau | Opcode::Lhaux | Opcode::Lhax => Some(DataType::Int16), Opcode::Lha | Opcode::Lhau | Opcode::Lhaux | Opcode::Lhax => Some(DataType::Int16),