-
Notifications
You must be signed in to change notification settings - Fork 335
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
More Integer conversions #1861
More Integer conversions #1861
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. Let's give this a CHANGELOG entry
Co-authored-by: Simon Warta <[email protected]>
output.copy_from_slice(&input[(INPUT_SIZE - OUTPUT_SIZE)..]); | ||
Some(output) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to try to upstream those. I.e. go from BInt::<X>
to BInt::<Y>
. Then you can also operate in 8 steps which should be faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, after looking into this, there seems to already be a way of casting them using bnum
's CastFrom
or As
trait, but it needs nightly features to be const
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright cool. This solution is good anyways. I just want to be nice and upstream ideas and code where possible.
closes #1855
Added some missing
From
andTryFrom
impl to convert between signed integers.