Skip to content

Commit

Permalink
Add log2, log10 and log256 functions (OpenZeppelin#3670)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx authored and JulissaDantes committed Nov 4, 2022
1 parent b57beee commit 9074c62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/utils/math/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,11 @@ library Math {
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
<<<<<<< HEAD
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
=======
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
>>>>>>> 8bdaadd1 (Add log2, log10 and log256 functions (#3670))
}
}
}

0 comments on commit 9074c62

Please sign in to comment.