Skip to content

Commit

Permalink
Comment explaining shift usage added
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu committed Jan 10, 2025
1 parent 132ceab commit 0e26ab7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions contracts/common/StorageAccessible.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ abstract contract StorageAccessible {
* @return the bytes that were read.
*/
function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {
// We use `<< 5` instead of `* 32` as SHR / SHL opcode only uses 3 gas, while DIV / MUL opcode uses 5 gas.
bytes memory result = new bytes(length << 5);
for (uint256 index = 0; index < length; index++) {
/* solhint-disable no-inline-assembly */
Expand Down

0 comments on commit 0e26ab7

Please sign in to comment.