libmp: optimize case x/0xffffffff in mpdigdiv() (helps arm)
This commit is contained in:
parent
d901fbe4f1
commit
a4e32b43ea
1 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,19 @@ mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// very common case
|
||||||
|
if(~divisor == 0){
|
||||||
|
lo += hi;
|
||||||
|
if(lo < hi){
|
||||||
|
hi++;
|
||||||
|
lo++;
|
||||||
|
}
|
||||||
|
if(lo+1 == 0)
|
||||||
|
hi++;
|
||||||
|
*quotient = hi;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// at this point we know that hi < divisor
|
// at this point we know that hi < divisor
|
||||||
// just shift and subtract till we're done
|
// just shift and subtract till we're done
|
||||||
q = 0;
|
q = 0;
|
||||||
|
|
Loading…
Reference in a new issue