X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbn%2Fbn_div.c;h=830da87f58e047f7156a0b2aacd2195bb3495480;hb=f18a93ab04f248de45a8bcdded9b91880c690dbd;hp=defcf90c8223d282b36306aa3737dc3b22ca7460;hpb=adc7fe123bffef5514dd0fe18e184623a589b3d3;p=oweals%2Fopenssl.git diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c index defcf90c82..830da87f58 100644 --- a/crypto/bn/bn_div.c +++ b/crypto/bn/bn_div.c @@ -200,57 +200,99 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, for (i=0; i=2 +# if defined(__i386) + /* + * There were two reasons for implementing this template: + * - GNU C generates a call to a function (__udivdi3 to be exact) + * in reply to ((((BN_ULLONG)n0)< + */ +# define bn_div_words(n0,n1,d0) \ + ({ asm volatile ( \ + "divl %4" \ + : "=a"(q), "=d"(rem) \ + : "a"(n1), "d"(n0), "g"(d0) \ + : "cc"); \ + q; \ + }) +# define REMINDER_IS_ALREADY_CALCULATED +# endif /* __ */ +# endif /* __GNUC__ */ +#endif /* NO_ASM */ + BN_ULONG n0,n1,rem=0; - wnum.d--; wnum.top++; n0=wnump[0]; n1=wnump[-1]; if (n0 == d0) q=BN_MASK2; else +#if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words) + q=(BN_ULONG)(((((BN_ULLONG)n0)<>BN_BITS2) || - (t2 <= ((rem< t1l) t3h++; - t3h=(t1h-t3h)&BN_MASK2; - - /*if ((t3>>BN_BITS2) || - (t2 <= ((t3<d,sdiv->d,div_n,q); + wnum.d--; wnum.top++; tmp->d[div_n]=l0; for (j=div_n+1; j>0; j--) if (tmp->d[j-1]) break;