Skip to content

Commit

Permalink
use return variable for the cast uint32
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkjester committed Oct 25, 2024
1 parent f810c0c commit 77a6e99
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ library SparseMerkleTreeVerifier {
/**
* @notice Tries to safely cast to uint32.
* @param _value The value being cast to uint32.
* @return castUint32 Returns a uint32 safely cast.
* @dev This is based on OpenZeppelin's SafeCast library.
*/
function safeCastToUint32(uint256 _value) internal pure returns (uint32) {
function safeCastToUint32(uint256 _value) internal pure returns (uint32 castUint32) {
if (_value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, _value);
}
return uint32(_value);
castUint32 = uint32(_value);
}
}

0 comments on commit 77a6e99

Please sign in to comment.