pub enum OperandType<'e> {
Arch(ArchId<'e>),
Constant(u64),
Memory(MemAccess<'e>),
Arithmetic(ArithOperand<'e>),
ArithmeticFloat(ArithOperand<'e>, MemAccessSize),
Undefined(UndefinedId),
SignExtend(Operand<'e>, MemAccessSize, MemAccessSize),
Select(Operand<'e>, Operand<'e>, Operand<'e>),
Custom(u32),
}
Expand description
Different values an Operand
can hold.
Variants§
Arch(ArchId<'e>)
A variable representing some CPU state, such as a register or a flag.
Constant(u64)
A constant integer.
Memory(MemAccess<'e>)
A variable representing memory read. Scarf currently assumes memory to always be little-endian.
Arithmetic(ArithOperand<'e>)
Integer arithmetic expression of two Operand
s.
ArithmeticFloat(ArithOperand<'e>, MemAccessSize)
Float arithmetic expression of two Operand
s.
MemAccessSize
is used to specify in what sized IEEE 754 floats (Effectively just
32- or 64-bit) the operation and input operands are. Note that constant inputs still
use integer constant type OperandType::Constant
, you will have to use f32::from_bits
and f32::to_bits
(Or equivalent f64
functions for MemAccessSize::Mem64
) to
inspect constant inputs as floats.
Undefined(UndefinedId)
An “completely unknown” variable, which is result of merging two
differing Operand
s during a FuncAnalysis
run.
SignExtend(Operand<'e>, MemAccessSize, MemAccessSize)
Sign extends the input Operand
from first MemAccessSize
to second MemAccessSize
.
Select(Operand<'e>, Operand<'e>, Operand<'e>)
If-else / ternary operator: if .0 != 0 { .1 } else { .2 }
.
Note: Any nonzero value for condition is considered true, no limitation that
condition has to be 0/1.
Custom(u32)
Arbitrary user-defined variable.
This is never created by scarf itself, and the user code may assign any meaning to the integer value.
Implementations§
Source§impl<'e> OperandType<'e>
impl<'e> OperandType<'e>
Sourcepub fn expr_size(&self) -> MemAccessSize
pub fn expr_size(&self) -> MemAccessSize
Returns whether the operand is 8, 16, 32, or 64 bits. Relevant with signed multiplication, usually operands can be considered zero-extended u32.
Trait Implementations§
Source§impl<'e> Clone for OperandType<'e>
impl<'e> Clone for OperandType<'e>
Source§fn clone(&self) -> OperandType<'e>
fn clone(&self) -> OperandType<'e>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more