Reduce gas in log256 (#3745)

This commit is contained in:
Tom French
2022-10-05 21:19:28 +01:00
committed by GitHub
parent b7aff6363f
commit 34e5863cd5
2 changed files with 2 additions and 1 deletions

View File

@ -339,7 +339,7 @@ library Math {
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}