ethereum-optimism / ethereum-optimism/optimism
Bitwise expression simplification
Open
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
Assessment
This issue has not been assessed yet.