Skip to content

Commit

Permalink
♻️ Add missing pure modifiers to math functions (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGrandpa925 authored May 17, 2022
1 parent d7f03ab commit 0303df8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/BitwiseLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ library BitwiseLib {
// @returns floor(log2(x)) if x is nonzero, otherwise 0.
// This is the same as the location of the highest set bit.
// Consumes 232 gas. This could have been an 3 gas EVM opcode though.
function ilog2(uint256 x) internal returns (uint256 r) {
function ilog2(uint256 x) internal pure returns (uint256 r) {
assembly {
r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
Expand Down
2 changes: 1 addition & 1 deletion src/utils/FixedPointMathLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ library FixedPointMathLib {
// reverts with `LnNegativeUndefined()` if x is negative, and with
// `Overflow()` if x is zero.
// Consumes about 670 gas.
function lnWad(int256 x) internal returns (int256 r) {
function lnWad(int256 x) internal pure returns (int256 r) {
unchecked {
if (x < 1) {
if (x < 0) revert LnNegativeUndefined();
Expand Down

0 comments on commit 0303df8

Please sign in to comment.