127 |
|
|
128 |
#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) && !defined(BN_DIV3W) |
#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) && !defined(BN_DIV3W) |
129 |
# if defined(__GNUC__) && __GNUC__>=2 |
# if defined(__GNUC__) && __GNUC__>=2 |
130 |
# if defined(__i386) |
# if defined(__i386) || defined (__i386__) |
131 |
/* |
/* |
132 |
* There were two reasons for implementing this template: |
* There were two reasons for implementing this template: |
133 |
* - GNU C generates a call to a function (__udivdi3 to be exact) |
* - GNU C generates a call to a function (__udivdi3 to be exact) |
189 |
|
|
190 |
/* First we normalise the numbers */ |
/* First we normalise the numbers */ |
191 |
norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
192 |
BN_lshift(sdiv,divisor,norm_shift); |
if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err; |
193 |
sdiv->neg=0; |
sdiv->neg=0; |
194 |
norm_shift+=BN_BITS2; |
norm_shift+=BN_BITS2; |
195 |
BN_lshift(snum,num,norm_shift); |
if (!(BN_lshift(snum,num,norm_shift))) goto err; |
196 |
snum->neg=0; |
snum->neg=0; |
197 |
div_n=sdiv->top; |
div_n=sdiv->top; |
198 |
num_n=snum->top; |
num_n=snum->top; |
314 |
tmp->top=j; |
tmp->top=j; |
315 |
|
|
316 |
j=wnum.top; |
j=wnum.top; |
317 |
BN_sub(&wnum,&wnum,tmp); |
if (!BN_sub(&wnum,&wnum,tmp)) goto err; |
318 |
|
|
319 |
snum->top=snum->top+wnum.top-j; |
snum->top=snum->top+wnum.top-j; |
320 |
|
|
322 |
{ |
{ |
323 |
q--; |
q--; |
324 |
j=wnum.top; |
j=wnum.top; |
325 |
BN_add(&wnum,&wnum,sdiv); |
if (!BN_add(&wnum,&wnum,sdiv)) goto err; |
326 |
snum->top+=wnum.top-j; |
snum->top+=wnum.top-j; |
327 |
} |
} |
328 |
*(resp--)=q; |
*(resp--)=q; |