Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Add missing pure modifiers to math functions #235

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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