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

Combine mux constraints and use simplified bitstring algorithm for BigLessThan. #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BlakeMScurr
Copy link

While I was exploring this library I noticed some simple improvements.

The main change is replacing the boolean logic in BigLessThan with bit manipulation, which removes 2 constraints if we're using 3 registers, and 4 if we're using 4.

All relevant tests are passing, though I didn't run the whole suite for fear of overheating my laptop.

Rather than using boolean logic, construct and compare two bit strings
which represent the registers where a > b, and where b > a respectively.

As well as simplifying the code, this removes 2 constraints where k=3
and 4 where k=4 for 256 bit big ints.
@BlakeMScurr BlakeMScurr changed the title Simplify code and make minor optimisations Simplify bigint and make minor optimisations Nov 30, 2022
@BlakeMScurr BlakeMScurr changed the title Simplify bigint and make minor optimisations Combine mux constraints and use simplified bitstring algorithm for BigLessThan. Dec 1, 2022
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