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

Branchless ternary, min and max methods #4976

Merged
merged 20 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix solidity lint
  • Loading branch information
Lohann committed Apr 22, 2024
commit e7f5c42091f81355dd7fd57c1e0c8b9894b68305
2 changes: 1 addition & 1 deletion contracts/utils/math/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ library Math {

/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/math/SignedMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {SafeCast} from "./SafeCast.sol";
library SignedMath {
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
Expand Down
Loading