Lines Matching full:sdiv
118 BIGNUM *tmp, wnum, *snum, *sdiv, *res;
157 sdiv = BN_CTX_get(ctx);
163 if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL) {
169 if (!(BN_lshift(sdiv, divisor, norm_shift))) {
172 sdiv->neg = 0;
180 /* Since we don't know whether snum is larger than sdiv,
184 if (snum->top <= sdiv->top + 1) {
185 if (bn_wexpand(snum, sdiv->top + 2) == NULL) {
188 for (i = snum->top; i < sdiv->top + 2; i++) {
191 snum->top = sdiv->top + 2;
201 div_n = sdiv->top;
213 /* Get the top 2 words of sdiv */
214 /* div_n=sdiv->top; */
215 d0 = sdiv->d[div_n - 1];
216 d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
235 if (BN_ucmp(&wnum, sdiv) >= 0) {
236 bn_sub_words(wnum.d, wnum.d, sdiv->d, div_n);
253 /* the first part of the loop uses the top two words of snum and sdiv to
254 * calculate a BN_ULONG q such that | wnum - sdiv * q | < sdiv */
337 l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
344 * two BN_ULONGs in the calculation of q, sdiv * q
345 * might be greater than wnum (but then (q-1) * sdiv
349 if (bn_add_words(wnum.d, wnum.d, sdiv->d, div_n)) {