-
Notifications
You must be signed in to change notification settings - Fork 9
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
Ability to create larger constants. #38
Comments
You can instantiate an arbitrarily large number with the Due to the fact that dashu aims to support arbitrarily large numbers, which essentially means allocation is unavoidable, this won't be implemented until Rust supports const allocation. Thanks for your interest! |
What about something along the lines of rust-num/num-bigint#286 this PR (WIP) where a Playing around with the above PR (for another bigint library) it wasn't really too bad to deal with. |
that sounds interesting for me, however I'm not sure whether it goes well with the already pretty complex internal design of dashu integers. PR is welcome! |
After a second thought, I think the best way to handle this is to provide a function that converts a reference to a static array to a reference of (static) big integers using some trick. Direct instantiating a big integer is problematic because it conflicts with the internal design of ubig. I have to add a separate flag for the "borrowed" status, which increases the number of cases to be dealt with for unary and binary operators a lot. Therefore, if something like |
I have implemented two macros |
What a great Christmas gift! I'll check it out when I get back home. Thanks! |
Nevermind. You were talking about the Looks great! |
Yep, as long as the created |
Unfortunately, the addition of some const functions requires Rust 1.64. Therefore I have to bump the MSRV, which requires a major version release. The new major version will take about 1 or 2 months tho.. |
I managed to implement this without increase MSRV, so a new version is published. Please check out the |
There are many constant values that people might want to create in their projects that are 256 bit, 512 bit etc.
Currently with DWord we can instantiate 128 bit values on 64 bit arch.
It would be nice to be able to instantiate a const value for up to 512 bit regardless of the arch bits.
Thoughts?
The text was updated successfully, but these errors were encountered: