Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

feat: use scarb macro to generate const powers #865

Closed
wants to merge 3 commits into 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
Contributor

enitrat commented Aug 23, 2024

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

@enitrat
Copy link
Contributor

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
@enitrat enitrat force-pushed the feat/alexandria-macros branch from ce294c2 to 02b76ba Compare September 9, 2024 16:02
@enitrat enitrat closed this Dec 3, 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.

feat: use scarb macro to generate const powers
2 participants