Lines Matching defs:sdiv
194 BIGNUM *tmp, wnum, *snum, *sdiv, *res;
246 sdiv = BN_CTX_get(ctx);
251 if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL)
256 if (!(BN_lshift(sdiv, divisor, norm_shift)))
258 sdiv->neg = 0;
266 * Since we don't know whether snum is larger than sdiv, we pad snum
269 if (snum->top <= sdiv->top + 1) {
270 if (bn_wexpand(snum, sdiv->top + 2) == NULL)
272 for (i = snum->top; i < sdiv->top + 2; i++)
274 snum->top = sdiv->top + 2;
283 div_n = sdiv->top;
298 /* Get the top 2 words of sdiv */
299 /* div_n=sdiv->top; */
300 d0 = sdiv->d[div_n - 1];
301 d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
318 if (BN_ucmp(&wnum, sdiv) >= 0) {
325 bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
343 * the first part of the loop uses the top two words of snum and sdiv
344 * to calculate a BN_ULONG q such that | wnum - sdiv * q | < sdiv
432 l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
442 * the calculation of q, sdiv * q might be greater than wnum (but
443 * then (q-1) * sdiv is less or equal than wnum)
446 if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n))