-
Notifications
You must be signed in to change notification settings - Fork 13.3k
BigUint always use u64 as the internal machine unsigned integer #13880
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
Conversation
#[inline] | ||
pub fn from_uint(n: uint) -> (BigDigit, BigDigit) { | ||
pub fn from_machineuint(n: MachineUint) -> (BigDigit, BigDigit) { |
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.
This is a public-facing method, so this has the possibility of breaking existing code.
Could you adjust the commit message according to our guidelines?
Why did this change from uint
to MachineInt
? If it's always u64
, could this just be from_u64
?
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.
I change the commit message to reflect that. The story is that it was not clear before if a uint
is an index/len or if it is the machine representation used internally. That's why I used MachineUint
to be clear.
I do not use directly u64 for future optimization. For example, I can imagine that when we have u128
, MachineUint cat be u128
if the performances are better.
Finally, maybe the cleanest thing to do is to make BigDigit
private because it looks like internal plumbing, not public API.
Why is it called |
@kballard as said upward, because maybe later, we will want to use |
@TeXitoi I'm confused because it's |
@kballard for you, |
@TeXitoi I'm not particularly familiar with the |
This change allow a speedup of ~1.5 on shootout-pidigits on a i32 system. `DoubleBigDigit` is used to abstract the internal unsigned integer used in computation to simplity future architecture specialization. `BigDigit::from_uint` and `BigDigit::to_uint` become `BigDigit::from_doublebigdigit` and `BigDigit::to_doublebigdigit`. [breaking-change]
@kballard just renamed |
This change allow a speedup of ~1.5 on shootout-pidigits on a i32 system. `MachineUint` is used to abstract the internal machine unsigned integer to simplity future architecture specialization.
Fixes rust-lang/rust-clippy#13744. A simple check to check if the type is an `Option` allows to improve the suggestion. changelog: Improve `needless_pass_by_value` suggestion
This change allow a speedup of ~1.5 on shootout-pidigits on a i32
system.
MachineUint
is used to abstract the internal machineunsigned integer to simplity future architecture specialization.