Skip to content

Commit 2e600b2

Browse files
Add method for getting raw operand from llil operation
1 parent 891ebd2 commit 2e600b2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

rust/src/low_level_il/operation.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ where
8888
};
8989
PossibleValueSet::from_owned_core_raw(raw_pvs)
9090
}
91+
92+
/// Get the raw operand from the operand list.
93+
///
94+
/// This has no type information associated with it. It's up to the caller to know what the correct type of the
95+
/// underlying u64 should be.
96+
///
97+
/// # Panic
98+
/// `idx` must be less than 4. This is to protect against an out of bounds access.
99+
///
100+
/// # Safety
101+
/// Even if `idx` is valid, it may index to an unitialized or unused value. Make sure you index into an operand that
102+
/// you know should be initialized properly.
103+
pub unsafe fn get_operand(&self, idx: usize) -> u64 {
104+
assert!(idx < 4);
105+
self.op.operands[idx]
106+
}
91107
}
92108

93109
impl<M, O> Operation<'_, M, NonSSA, O>

0 commit comments

Comments
 (0)