mirror of https://github.com/encounter/objdiff.git
Compare commits
2 Commits
74e89130a8
...
e4f97adbdd
Author | SHA1 | Date |
---|---|---|
Luke Street | e4f97adbdd | |
Luke Street | 0ec7bf078b |
|
@ -2658,7 +2658,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objdiff"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "objdiff"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
authors = ["Luke Street <luke@street.dev>"]
|
||||
|
|
|
@ -50,6 +50,30 @@ pub enum ObjInsArg {
|
|||
BranchOffset(i32),
|
||||
}
|
||||
|
||||
impl ObjInsArg {
|
||||
pub fn loose_eq(&self, other: &ObjInsArg) -> bool {
|
||||
match (self, other) {
|
||||
(ObjInsArg::PpcArg(a), ObjInsArg::PpcArg(b)) => {
|
||||
a == b
|
||||
|| match (a, b) {
|
||||
// Consider Simm and Offset equivalent
|
||||
(ppc750cl::Argument::Simm(simm), ppc750cl::Argument::Offset(off))
|
||||
| (ppc750cl::Argument::Offset(off), ppc750cl::Argument::Simm(simm)) => {
|
||||
simm.0 == off.0
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
(ObjInsArg::MipsArg(a), ObjInsArg::MipsArg(b)) => a == b,
|
||||
(ObjInsArg::MipsArgWithBase(a), ObjInsArg::MipsArgWithBase(b)) => a == b,
|
||||
(ObjInsArg::Reloc, ObjInsArg::Reloc) => true,
|
||||
(ObjInsArg::RelocWithBase, ObjInsArg::RelocWithBase) => true,
|
||||
(ObjInsArg::BranchOffset(a), ObjInsArg::BranchOffset(b)) => a == b,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct ObjInsArgDiff {
|
||||
/// Incrementing index for coloring
|
||||
|
|
|
@ -194,7 +194,7 @@ fn write_ins(
|
|||
HighlightKind::Address(v) => {
|
||||
matches!(arg, ObjInsArg::BranchOffset(offset) if (offset + ins.address as i32 - base_addr as i32) as u32 == *v)
|
||||
}
|
||||
HighlightKind::Arg(v) => v == arg,
|
||||
HighlightKind::Arg(v) => v.loose_eq(arg),
|
||||
_ => false,
|
||||
};
|
||||
let color = if highlighted_arg {
|
||||
|
|
Loading…
Reference in New Issue