/[rdesktop]/sourceforge.net/trunk/rdesktop/crypto/bn_div.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/crypto/bn_div.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 194 by matty, Sat Sep 15 09:37:17 2001 UTC revision 195 by matthewc, Wed Sep 25 09:00:57 2002 UTC
# Line 127  int BN_div(BIGNUM *dv, BIGNUM *rem, cons Line 127  int BN_div(BIGNUM *dv, BIGNUM *rem, cons
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)
# Line 189  int BN_div(BIGNUM *dv, BIGNUM *rm, const Line 189  int BN_div(BIGNUM *dv, BIGNUM *rm, const
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;
# Line 314  int BN_div(BIGNUM *dv, BIGNUM *rm, const Line 314  int BN_div(BIGNUM *dv, BIGNUM *rm, const
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    
# Line 322  int BN_div(BIGNUM *dv, BIGNUM *rm, const Line 322  int BN_div(BIGNUM *dv, BIGNUM *rm, const
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;

Legend:
Removed from v.194  
changed lines
  Added in v.195

  ViewVC Help
Powered by ViewVC 1.1.26