Skip to content

Commit

Permalink
Use ppc750cl Opcode::from
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Sep 27, 2024
1 parent 67719dd commit c589668
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions objdiff-core/src/arch/ppc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u8, Opcode>(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),
Expand Down

0 comments on commit c589668

Please sign in to comment.