Skip to content

Commit

Permalink
feat: implement 0x1C - SHR opcode (#237)
Browse files Browse the repository at this point in the history
* SHR

* Use wrapping_shr

* scarb fmt
  • Loading branch information
khaeljy authored Sep 1, 2023
1 parent 417ba5b commit 61d1e41
Show file tree
Hide file tree
Showing 2 changed files with 431 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/evm/src/instructions/comparison_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ impl ComparisonAndBitwiseOperations of ComparisonAndBitwiseOperationsTrait {
/// 0x1C - SHR
/// # Specification: https://www.evm.codes/#1c?fork=shanghai
fn exec_shr(ref self: ExecutionContext) -> Result<(), EVMError> {
Result::Ok(())
let popped = self.stack.pop_n(2)?;
let shift = *popped[0];
let value = *popped[1];

let result = value.wrapping_shr(shift);
self.stack.push(result)
}

/// 0x1D - SAR
Expand Down
Loading

0 comments on commit 61d1e41

Please sign in to comment.