Skip to content

Conversation

@pcaversaccio
Copy link
Owner

@pcaversaccio pcaversaccio commented Aug 4, 2023

We simplify the twos calculation in mul_div in a similar way as proposed here. This will save one operation.

image

Explanation: -x in two's complement (where x is uint256) is defined as ~x + 1 which is max_value(uint256) - x + 1. Thus, -x -> 0 + max_value(uint256) - x + 1 -> unsafe_sub(0, x) as long as x>=1 holds.

Furthermore, we bump eslint-config-prettier, ethers, and prettier to the corresponding latest versions. Eventually, the submodule openzeppelin-contracts is bumped to the latest available commit.

🐶 Cute Animal Picture

image

Signed-off-by: Pascal Marco Caversaccio <[email protected]>
@pcaversaccio pcaversaccio added documentation 📖 Improvements or additions to documentation dependencies 🔁 Pull requests that update a dependency file optimisation ⚡️ Code optimisations (e.g. gas improvements) labels Aug 4, 2023
@pcaversaccio pcaversaccio added this to the 0.0.3 milestone Aug 4, 2023
@pcaversaccio pcaversaccio self-assigned this Aug 4, 2023
@pcaversaccio pcaversaccio merged commit 1db346f into main Aug 4, 2023
@pcaversaccio pcaversaccio deleted the optimise-muldiv branch August 4, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies 🔁 Pull requests that update a dependency file documentation 📖 Improvements or additions to documentation optimisation ⚡️ Code optimisations (e.g. gas improvements)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants