Skip to content

Commit 9f4b673

Browse files
committed
More rust cleanup
- Remove under_construction.png from the build.rs it has been removed - Use InstructionIndex in more places - Add missing PartialOrd and Ord impls for id types
1 parent e470e44 commit 9f4b673

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

rust/build.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ fn main() {
44
let _ = std::fs::create_dir("target");
55
let _ = std::fs::create_dir("target/doc");
66
let _ = std::fs::copy("../docs/img/favicon.ico", "target/doc/favicon.ico");
7-
let _ = std::fs::copy(
8-
"assets/under_construction.png",
9-
"target/doc/under_construction.png",
10-
);
117
let _ = std::fs::copy("../docs/img/logo.png", "target/doc/logo.png");
128

139
let link_path =

rust/src/architecture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub use binaryninjacore_sys::BNLowLevelILFlagCondition as FlagCondition;
5454

5555
macro_rules! newtype {
5656
($name:ident, $inner_type:ty) => {
57-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
57+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
5858
pub struct $name(pub $inner_type);
5959

6060
impl From<$inner_type> for $name {

rust/src/llil/instruction.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ use crate::architecture::Architecture;
2626
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
2727
pub struct InstructionIndex(pub usize);
2828

29+
impl InstructionIndex {
30+
pub fn next(&self) -> Self {
31+
Self(self.0 + 1)
32+
}
33+
}
34+
2935
impl Display for InstructionIndex {
3036
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
3137
f.write_fmt(format_args!("{}", self.0))

rust/src/llil/operation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ where
412412
Expression::new(self.function, ExpressionIndex(self.op.operands[0] as usize))
413413
}
414414

415-
pub fn target_list(&self) -> BTreeMap<u64, usize> {
415+
pub fn target_list(&self) -> BTreeMap<u64, InstructionIndex> {
416416
let mut result = BTreeMap::new();
417417
let count = self.op.operands[1] as usize / 2;
418418
let mut list = TargetListIter {
@@ -425,7 +425,7 @@ where
425425

426426
for _ in 0..count {
427427
let value = list.next();
428-
let target = list.next() as usize;
428+
let target = InstructionIndex(list.next() as usize);
429429
result.insert(value, target);
430430
}
431431

0 commit comments

Comments
 (0)