libmp: optimize case x/0xffffffff in mpdigdiv() (helps arm)

front
cinap_lenrek 2015-11-01 12:12:41 +01:00
parent d901fbe4f1
commit a4e32b43ea
1 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,19 @@ mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient)
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
// just shift and subtract till we're done
q = 0;