Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f58ce4

Browse files
authoredJul 16, 2020
Sorry for the missing...
I checked all the implementations, and finally found that there is one function that does not check whether `exp == 0`
1 parent 020c0b5 commit 8f58ce4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/libcore/num/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -4040,6 +4040,9 @@ assert_eq!(3u8.overflowing_pow(6), (217, true));", $EndFeature, "
40404040
without modifying the original"]
40414041
#[inline]
40424042
pub const fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
4043+
if exp == 0{
4044+
return (1,false);
4045+
}
40434046
let mut base = self;
40444047
let mut acc: Self = 1;
40454048
let mut overflown = false;

0 commit comments

Comments
 (0)
Please sign in to comment.