Home | History | Annotate | Download | only in bn

Lines Matching defs:sdiv

185 	BIGNUM *tmp,wnum,*snum,*sdiv,*res;
228 sdiv=BN_CTX_get(ctx);
232 if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL)
237 if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
238 sdiv->neg=0;
242 div_n=sdiv->top;
254 /* Get the top 2 words of sdiv */
255 /* div_n=sdiv->top; */
256 d0=sdiv->d[div_n-1];
257 d1=(div_n == 1)?0:sdiv->d[div_n-2];
271 if (BN_ucmp(&wnum,sdiv) >= 0)
277 bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
293 * snum and sdiv to calculate a BN_ULONG q such that
294 * | wnum - sdiv * q | < sdiv */
380 l0=bn_mul_words(tmp->d,sdiv->d,div_n,q);
388 * two BN_ULONGs in the calculation of q, sdiv * q
389 * might be greater than wnum (but then (q-1) * sdiv
393 if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n))
430 BIGNUM *tmp,wnum,*snum,*sdiv,*res;
449 sdiv=BN_CTX_get(ctx);
453 if (sdiv == NULL || res == NULL) goto err;
457 if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
458 sdiv->neg=0;
463 /* Since we don't know whether snum is larger than sdiv,
467 if (snum->top <= sdiv->top+1)
469 if (bn_wexpand(snum, sdiv->top + 2) == NULL) goto err;
470 for (i = snum->top; i < sdiv->top + 2; i++) snum->d[i] = 0;
471 snum->top = sdiv->top + 2;
480 div_n=sdiv->top;
492 /* Get the top 2 words of sdiv */
493 /* div_n=sdiv->top; */
494 d0=sdiv->d[div_n-1];
495 d1=(div_n == 1)?0:sdiv->d[div_n-2];
520 * snum and sdiv to calculate a BN_ULONG q such that
521 * | wnum - sdiv * q | < sdiv */
607 l0=bn_mul_words(tmp->d,sdiv->d,div_n,q);
615 * two BN_ULONGs in the calculation of q, sdiv * q
616 * might be greater than wnum (but then (q-1) * sdiv
620 if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n))