Conversation
| (prim_int $t:ty) => { | ||
| pow_impl!($t, u8); | ||
| pow_impl!($t, u16); | ||
| pow_impl!($t, u32, u32, <$t>::pow); |
There was a problem hiding this comment.
Utilizes the default implementation of pow for exp with u32
| if exp == 0 { | ||
| pub fn pow<T, U>(mut base: T, mut exp: U) -> T | ||
| where | ||
| T: Clone + One, |
There was a problem hiding this comment.
I removed T: Mul<T, Output = T> because One needs it.
|
It is an unfortunate historical difference, but I think the |
|
Thank you for taking a look.
I am sorry that my English ability is not sufficient, but am I right in interpreting you think it is too much to change
I know others may have a interest in one (ref #254) and I am not against the idea to add one. I consider making a pull request once the idea of generalizing exp is accepted, for I do not want to yield another FIXME. Lines 26 to 29 in 61d9a1b Maybe I should have created an issue first. I apologize if discussing the idea here is quite inappropriate. |
Due to the
expbeingusize, the current implementation has been inconsistent with core implementation ofpowandchecked_powtakingu32forexp. This has also inhibited implementation of somePow<u*>for primitive integers.This pull request generalizes
expto use unsigned primitive integer for the sake of the implementation of lackingPow<u*>and more importantly, I guess, the consistency with corepowandchecked_powutilizingu32, for the use of architecture dependently sized type, namelyusizehere, for arithmetic function does not sound reasonable.Although this change should be a minor change as
usizedoes implementsPrimInt + Unsigned, please note that the existing crate depending on the functions in question may come to be in need of adding some type notation, as {integer} is assumed to bei32.