Skip to content

Commit

Permalink
unchecked arithmetic to preserve previous behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrin1 authored and RyanRHall committed Oct 19, 2021
1 parent 849e3f5 commit 5b3d647
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/strings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ library strings {
if(shortest < 32) {
mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
}
uint256 diff = (a & mask) - (b & mask);
if (diff != 0)
return int(diff);
unchecked {
uint256 diff = (a & mask) - (b & mask);
if (diff != 0)
return int(diff);
}
}
selfptr += 32;
otherptr += 32;
Expand Down

0 comments on commit 5b3d647

Please sign in to comment.