pub fn extract_push_value(instruction: &DisassemblyInstruction) -> Option<U256>Expand description
Extract immediate value from a PUSH instruction as a big-endian integer
This helper function converts the bytes from a PUSH instruction into a big-endian integer representation. Useful for analyzing PUSH values numerically.
§Arguments
instruction- The PUSH instruction to extract value from
§Returns
The immediate value as a U256, or None if not a PUSH instruction
§Examples
use edb_engine::utils::disasm::{DisassemblyInstruction, extract_push_value};
use revm::bytecode::opcode::OpCode;
let push_inst = DisassemblyInstruction::with_push_data(
0,
unsafe { OpCode::new_unchecked(0x60) }, // PUSH1
vec![0x42]
);
assert_eq!(extract_push_value(&push_inst), 0x42);