Commit 562e4f53 authored by Daniel Fischer's avatar Daniel Fischer

merge

parents b879b2a4 d9f48df3
......@@ -1009,6 +1009,7 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
Bigint *b1, *p5, *p51=NULL;
int i;
static int p05[3]= { 5, 25, 125 };
my_bool overflow= FALSE;
if ((i= k & 3))
b= multadd(b, p05[i-1], 0, alloc);
......@@ -1027,16 +1028,19 @@ static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc)
if (!(k>>= 1))
break;
/* Calculate next power of 5 */
if (p5 < p5_a + P5A_MAX)
++p5;
else if (p5 == p5_a + P5A_MAX)
p5= mult(p5, p5, alloc);
else
if (overflow)
{
p51= mult(p5, p5, alloc);
Bfree(p5, alloc);
p5= p51;
}
else if (p5 < p5_a + P5A_MAX)
++p5;
else if (p5 == p5_a + P5A_MAX)
{
p5= mult(p5, p5, alloc);
overflow= TRUE;
}
}
if (p51)
Bfree(p51, alloc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment