Replies: 2 comments 2 replies
-
@AvivYossef-starkware what are your views on this at Starkware? |
Beta Was this translation helpful? Give feedback.
0 replies
-
We have a lot of use in U256. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Starknet offers 3 types that are not available in std rust: Felt252, u256, u512.
Felt252 has been taken care of by this crate.
I believe we should also provide something for the two others.
Both u256 and u512 are similar in their logic, so I will now talk uniquely of u256, but everything I say is also relevant for u512.
There is some design decision to be taken.
Do we want an actual type or a trait?
We could only offer a trait that allow to convert back an forth to the starknet representation of u256, which is a struct make of two u128 (low and high), and let the user decide which actual implementation he wants to use for the arithmetics operation on his type.
On the other hand we could offer an actual type, either by coding it ourselves or wrapping an existing lib (primitve-types, biguint, ...) while providing the required conversion methods.
What is your opinion on this? What have been your needs and solutions so far?
For my project I created a struct used for serialization/deserialization of starknet u256. And convert to
primitive-types
when I'm in need of doing actual computation.What about you?
Beta Was this translation helpful? Give feedback.
All reactions