Uh oh!
There was an error while loading. Please reload this page.
libcore: add num::Int::pow() and deprecate num::pow(). - #19031
Conversation
There was a problem hiding this comment.
Should probably be #[deprecated]?
alexcrichton
commented
Nov 17, 2014
I think that the design of The cc @aturon |
aturon
commented
Nov 17, 2014
I agree with @alexcrichton; please see the numerics reform RFC for details. I had been thinking we could/should move |
aturon
commented
Nov 17, 2014
cc @bjz |
Signed-off-by: NODA, Kai <nodakai@gmail.com>
4ed161a to
3fcf284Comparenodakai
commented
Nov 18, 2014
@gankro Yeah, I shouldn't have been so brutal! I deprecated the free function @alexcrichton@aturon Now this PR is only about the |
brendanzab
commented
Nov 18, 2014
The |
There was a problem hiding this comment.
Why did the implementation change?
There was a problem hiding this comment.
I simplified the code by removing the special case for exp==1 because we don't have the move semantics with primitive integers. exp /= 2 is more readable than exp = exp >> 1 and equivalent to it:
- http://is.gd/cYcfFU (hit the [ir] button)
There was a problem hiding this comment.
I'm guessing LLVM would optimise to a bit shift anyway.
What do you mean by 'don't have the move semantics with primitive integers'?
There was a problem hiding this comment.
@bjz The original code could move the base parameter to the caller as its return value when exp is 1. It could perhaps achieve better performance only with bigint objects whose initialization cost was not negligible.
brendanzab
commented
Nov 18, 2014
Updated the issue title and description. |
[breaking-change] Deprecates `core::num::pow` in favor of `Int::pow`.
[breaking-change]
Deprecates
core::num::powin favor ofInt::pow.