File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2477,18 +2477,18 @@ macro_rules! int_impl {
2477
2477
None
2478
2478
} else {
2479
2479
let mut n = 0 ;
2480
- let mut r = self ;
2480
+ let mut r = 1 ;
2481
2481
2482
2482
// Optimization for 128 bit wide integers.
2483
2483
if Self :: BITS == 128 {
2484
2484
let b = Self :: ilog2( self ) / ( Self :: ilog2( base) + 1 ) ;
2485
2485
n += b;
2486
- r / = base. pow( b as u32 ) ;
2486
+ r * = base. pow( b) ;
2487
2487
}
2488
2488
2489
- while r >= base {
2490
- r /= base;
2489
+ while r <= self / base {
2491
2490
n += 1 ;
2491
+ r *= base;
2492
2492
}
2493
2493
Some ( n)
2494
2494
}
Original file line number Diff line number Diff line change @@ -810,18 +810,18 @@ macro_rules! uint_impl {
810
810
None
811
811
} else {
812
812
let mut n = 0 ;
813
- let mut r = self ;
813
+ let mut r = 1 ;
814
814
815
815
// Optimization for 128 bit wide integers.
816
816
if Self :: BITS == 128 {
817
817
let b = Self :: ilog2( self ) / ( Self :: ilog2( base) + 1 ) ;
818
818
n += b;
819
- r / = base. pow( b as u32 ) ;
819
+ r * = base. pow( b) ;
820
820
}
821
821
822
- while r >= base {
823
- r /= base;
822
+ while r <= self / base {
824
823
n += 1 ;
824
+ r *= base;
825
825
}
826
826
Some ( n)
827
827
}
You can’t perform that action at this time.
0 commit comments