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

feat(bitmap): add bitmap features #296

Merged
merged 4 commits into from
Apr 22, 2024
Merged

feat(bitmap): add bitmap features #296

merged 4 commits into from
Apr 22, 2024

Conversation

bal7hazar
Copy link
Contributor

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

No bitmap management

Issue Number: #295

What is the new behavior?

  • bitmap::get_bit_at
  • bitmap::set_bit_at
  • bitmap::most_significant_bit
  • bitmap::least_significant_bit
  • bitmap::nearest_left_significant_bit
  • bitmap::nearest_right_significant_bit
  • bitmap::nearest_significant_bit

Does this introduce a breaking change?

  • Yes
  • No

fast_power has been renamed to fast_power_mod and a new fast_power derived from the previous one (without the mod operation) has been introduced.

Other information

fast_power has been made generic, revert from while to loop pattern to save gas (~10% for large power) and also to prevent overflow (an extra mul operation was done even if the remaining power was 0 due to while pattern).

@bal7hazar bal7hazar requested a review from 0xLucqs as a code owner April 22, 2024 09:57
@bal7hazar bal7hazar mentioned this pull request Apr 22, 2024
5 tasks
src/math/src/fast_power.cairo Outdated Show resolved Hide resolved
src/math/src/fast_power.cairo Outdated Show resolved Hide resolved
src/math/src/fast_power.cairo Show resolved Hide resolved
src/math/src/fast_power.cairo Outdated Show resolved Hide resolved
src/math/src/fast_power.cairo Outdated Show resolved Hide resolved
src/math/src/bitmap.cairo Outdated Show resolved Hide resolved
src/math/src/tests/bitmap_test.cairo Outdated Show resolved Hide resolved
@bal7hazar bal7hazar requested a review from 0xLucqs April 22, 2024 13:53
@0xLucqs 0xLucqs merged commit d68d46c into keep-starknet-strange:main Apr 22, 2024
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants