Skip to content

Commit

Permalink
Update contracts/utils/Strings.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx authored Oct 11, 2024
1 parent 7b7c1fd commit 2abfa49
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/utils/Strings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ library Strings {
) internal pure returns (bool success, int256 value) {
bytes memory buffer = bytes(input);

// check presence of a negative sign.
bool positiveSign = bytes1(buffer.unsafeReadBytesOffset(begin)) == bytes1("+");
bool negativeSign = bytes1(buffer.unsafeReadBytesOffset(begin)) == bytes1("-");
// Check presence of a negative sign.
bytes1 sign = bytes1(buffer.unsafeReadBytesOffset(begin));
bool positiveSign = sign == bytes1("+");
bool negativeSign = sign == bytes1("-");
uint256 offset = (positiveSign || negativeSign).toUint();

(bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);
Expand Down

0 comments on commit 2abfa49

Please sign in to comment.