Function bad64::decode[][src]

pub fn decode(ins: u32, address: u64) -> Result<Instruction, DecodeError>
Expand description

Decode a single instruction


  • ins - A little endian u32 of code to be decoded
  • address - Location of code in memory


use bad64::{decode, Op};

// NOTE: little endian
let decoded = decode(0xd503201f, 0x1000).unwrap();

assert_eq!(decoded.operands().len(), 0);
assert_eq!(decoded.operands(), &[]);
assert_eq!(decoded.op(), Op::NOP);
assert_eq!(decoded.op().mnem(), "nop");
assert_eq!(decoded.address(), 0x1000);