ethereum-optimism / ethereum-optimism/optimism

Bitwise expression simplification

Open
#13,445 0 comments 0 reactions 0 assignees View on GitHub
A-pkg-contracts-bedrock C-good first issue MT cannon - audit findings
Dominant language
Go
Stars
6.5k
Forks
4k
Avg merge
2d 38m
Merged PRs (30d)
164

Description

**Description**:

It seems signed is just ~mask. These lines can be replaced with:

uint256 mask = (1 << _idx) - 1;
uint256 signed = ~mask;
[packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol](https://cantina.xyz/code/4ea41142-4359-4f62-bfaa-a542172cab5d/packages/contracts-bedrock/src/cannon/libraries/MIPS64Instructions.sol#L595-L596)
uint256 signed = ((1 << (arch.WORD_SIZE - _idx)) - 1) << _idx;
uint256 mask = (1 << _idx) - 1;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.