@@ -732,7 +732,7 @@ powerOf5(APFloatBase::integerPart *dst, unsigned int power) {
732
732
APFloatBase::integerPart pow5s[maxPowerOfFiveParts * 2 + 5 ];
733
733
pow5s[0 ] = 78125 * 5 ;
734
734
735
- unsigned int partsCount[ 16 ] = { 1 } ;
735
+ unsigned int partsCount = 1 ;
736
736
APFloatBase::integerPart scratch[maxPowerOfFiveParts], *p1, *p2, *pow5;
737
737
unsigned int result;
738
738
assert (power <= maxExponent);
@@ -747,25 +747,20 @@ powerOf5(APFloatBase::integerPart *dst, unsigned int power) {
747
747
pow5 = pow5s;
748
748
749
749
for (unsigned int n = 0 ; power; power >>= 1 , n++) {
750
- unsigned int pc;
751
-
752
- pc = partsCount[n];
753
-
754
750
/* Calculate pow(5,pow(2,n+3)) if we haven't yet. */
755
- if (pc == 0 ) {
756
- pc = partsCount[n - 1 ];
757
- APInt::tcFullMultiply (pow5, pow5 - pc, pow5 - pc, pc, pc);
758
- pc *= 2 ;
759
- if (pow5[pc - 1 ] == 0 )
760
- pc--;
761
- partsCount[n] = pc;
751
+ if (n != 0 ) {
752
+ APInt::tcFullMultiply (pow5, pow5 - partsCount, pow5 - partsCount,
753
+ partsCount, partsCount);
754
+ partsCount *= 2 ;
755
+ if (pow5[partsCount - 1 ] == 0 )
756
+ partsCount--;
762
757
}
763
758
764
759
if (power & 1 ) {
765
760
APFloatBase::integerPart *tmp;
766
761
767
- APInt::tcFullMultiply (p2, p1, pow5, result, pc );
768
- result += pc ;
762
+ APInt::tcFullMultiply (p2, p1, pow5, result, partsCount );
763
+ result += partsCount ;
769
764
if (p2[result - 1 ] == 0 )
770
765
result--;
771
766
@@ -776,7 +771,7 @@ powerOf5(APFloatBase::integerPart *dst, unsigned int power) {
776
771
p2 = tmp;
777
772
}
778
773
779
- pow5 += pc ;
774
+ pow5 += partsCount ;
780
775
}
781
776
782
777
if (p1 != dst)
0 commit comments