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: use scarb macro to generate const powers #865

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

juankohler
Copy link

@juankohler juankohler commented Aug 23, 2024

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?

Resolves: #841

What is the new behavior?

  • Uses pow! macro instead of hardcoded constants.

Does this introduce a breaking change?

  • Yes
  • No

This change is Reviewable

@juankohler
Copy link
Author

Hi @enitrat, I have a problem. When I took the issue, I interpreted that I needed to export the Alexandria package, but then I realized that it was in Rust. When I looked into how to calculate the power of 2 at compile time in Cairo, I couldn't find any solution. The current utils only calculate at runtime up to 128. The only way I can think of is to hardcode the constants up to that number and create a function that returns them depending on the argument passed, but this doesn't seem like an optimal solution. Could you help me with this?

@enitrat
Copy link
Collaborator

enitrat commented Aug 23, 2024

I don't understand the problem. Can't you use the macro?

@enitrat
Copy link
Collaborator

enitrat commented Aug 23, 2024

merge blocked until snfoundry allows use of scarb macros

@juankohler juankohler changed the title feat: add alexandria_macros dependency feat: use scarb macro to generate const powers Aug 23, 2024
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.

feat: use scarb macro to generate const powers
2 participants