Some crypto applications are now being built on Unix, so they should on VMS as well...
[oweals/openssl.git] / crypto / bn / bn_div.c
index e4253f6095af82118bf20978e102de5711c532f6..830da87f58e047f7156a0b2aacd2195bb3495480 100644 (file)
@@ -202,10 +202,10 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
                {
                BN_ULONG q,l0;
 #ifdef BN_DIV3W
-               q=bn_div_3_words(wnump,d0,d1);
+               q=bn_div_3_words(wnump,d1,d0);
 #else
 
-#if !defined(NO_ASM)
+#if !defined(NO_ASM) && !defined(PEDANTIC)
 # if defined(__GNUC__) && __GNUC__>=2
 #  if defined(__i386)
    /*
@@ -238,7 +238,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
                        q=BN_MASK2;
                else
 #if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
-                       q=((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0;
+                       q=(BN_ULONG)(((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0);
 #else
                        q=bn_div_words(n0,n1,d0);
 #endif
@@ -291,8 +291,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 #endif
                }
 #endif /* !BN_DIV3W */
-               wnum.d--; wnum.top++;
                l0=bn_mul_words(tmp->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;