diff options
author | iximeow <me@iximeow.net> | 2021-07-01 23:54:06 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2021-07-01 23:54:06 -0700 |
commit | a781322552d9fb52b7b5e51641f49f12678f682f (patch) | |
tree | b7ea7042d707dca8ffc322ddac4ebd5b8c475027 /test/long_mode/mod.rs | |
parent | 889ce5c55af062d12cdd109bac22cc05565f68a6 (diff) |
reallocate OperandCode, convert disparate registers to array
also remove redundant assignments of operand_count and some OperandSpec,
bulk-assign all registers and operands on entry to `read_instr`. this
all, taken together, shaves off about 7 cycles per decode.
Diffstat (limited to 'test/long_mode/mod.rs')
-rw-r--r-- | test/long_mode/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index cbd881c..1eedfec 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -16,7 +16,8 @@ fn test_invalid(data: &[u8]) { } fn test_invalid_under(decoder: &InstDecoder, data: &[u8]) { - if let Ok(inst) = decoder.decode(data.into_iter().cloned()) { + let mut reader = yaxpeax_arch::U8Reader::new(data); + if let Ok(inst) = decoder.decode(&mut reader) { panic!("decoded {:?} from {:02x?} under decoder {}", inst.opcode(), data, decoder); } else { // this is fine @@ -32,7 +33,8 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str for b in data { write!(hex, "{:02x}", b).unwrap(); } - match decoder.decode(data.into_iter().map(|x| *x)) { + let mut reader = yaxpeax_arch::U8Reader::new(data); + match decoder.decode(&mut reader) { Ok(instr) => { let text = format!("{}", instr); assert!( |