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

allow compiler >=0.8.0 #1030

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

allow compiler >=0.8.0 #1030

wants to merge 1 commit into from

Conversation

Mathacc
Copy link

@Mathacc Mathacc commented Feb 14, 2025

This PR updates the computation of the largest power of two divisor of the denominator in the mulDiv function. It replaces:

uint256 twos = -denominator & denominator;

with

uint256 twos = denominator & (~denominator + 1);

The new expression is equivalent to the original but uses an explicit two's complement computation, improving code clarity and readability.

All tests pass, and the change does not alter the functionality of the code.
Also allows the compilation for compilers above 0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant