Lines Matching refs:used
118 int used, alloc, sign; member
124 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
125 #define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
126 #define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
130 #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
219 if (a->used > b->used) { in s_mp_add()
220 min = b->used; in s_mp_add()
221 max = a->used; in s_mp_add()
224 min = a->used; in s_mp_add()
225 max = b->used; in s_mp_add()
237 olduse = c->used; in s_mp_add()
238 c->used = max + 1; in s_mp_add()
288 for (i = c->used; i < olduse; i++) { in s_mp_add()
305 min = b->used; in s_mp_sub()
306 max = a->used; in s_mp_sub()
314 olduse = c->used; in s_mp_sub()
315 c->used = max; in s_mp_sub()
356 for (i = c->used; i < olduse; i++) { in s_mp_sub()
385 a->used = 0; in mp_init()
402 for (i = 0; i < a->used; i++) { in mp_clear()
411 a->alloc = a->used = 0; in mp_clear()
497 if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { in mp_mul()
503 if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { in mp_mul()
515 int digs = a->used + b->used + 1; in mp_mul()
518 MIN(a->used, b->used) <= in mp_mul()
531 c->sign = (c->used > 0) ? neg : MP_ZPOS; in mp_mul()
714 if (a->used > 1) { in mp_cmp_d()
935 if (a->used > b->used) { in mp_cmp_mag()
939 if (a->used < b->used) { in mp_cmp_mag()
944 tmpa = a->dp + (a->used - 1); in mp_cmp_mag()
947 tmpb = b->dp + (a->used - 1); in mp_cmp_mag()
950 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { in mp_cmp_mag()
987 a->used += 1; in mp_read_unsigned_bin()
991 a->used += 2; in mp_read_unsigned_bin()
1081 tmpc = c->dp + (c->used - 1); in mp_div_2d()
1085 for (x = c->used - 1; x >= 0; x--) { in mp_div_2d()
1126 a->used = 0; in mp_zero()
1147 if (b->alloc < a->used) { in mp_copy()
1148 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_copy()
1166 for (n = 0; n < a->used; n++) { in mp_copy()
1171 for (; n < b->used; n++) { in mp_copy()
1177 b->used = a->used; in mp_copy()
1195 if (a->used <= b) { in mp_rshd()
1221 for (x = 0; x < (a->used - b); x++) { in mp_rshd()
1226 for (; x < a->used; x++) { in mp_rshd()
1232 a->used -= b; in mp_rshd()
1263 while (a->used > 0 && a->dp[a->used - 1] == 0) { in mp_clamp()
1264 --(a->used); in mp_clamp()
1268 if (a->used == 0) { in mp_clamp()
1343 a->used = (a->dp[0] != 0) ? 1 : 0; in mp_set()
1355 if (b->alloc < a->used) { in mp_div_2()
1356 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_div_2()
1361 oldused = b->used; in mp_div_2()
1362 b->used = a->used; in mp_div_2()
1367 tmpa = a->dp + b->used - 1; in mp_div_2()
1370 tmpb = b->dp + b->used - 1; in mp_div_2()
1374 for (x = b->used - 1; x >= 0; x--) { in mp_div_2()
1386 tmpb = b->dp + b->used; in mp_div_2()
1387 for (x = b->used; x < oldused; x++) { in mp_div_2()
1412 if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { in mp_mul_2d()
1413 if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { in mp_mul_2d()
1442 for (x = 0; x < c->used; x++) { in mp_mul_2d()
1456 c->dp[(c->used)++] = r; in mp_mul_2d()
1532 if (a->alloc < a->used + b) { in mp_lshd()
1533 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { in mp_lshd()
1542 a->used += b; in mp_lshd()
1545 top = a->dp + a->used - 1; in mp_lshd()
1548 bottom = a->dp + a->used - 1 - b; in mp_lshd()
1554 for (x = a->used - 1; x >= b; x--) { in mp_lshd()
1576 if (a->used == 0) { in mp_count_bits()
1581 r = (a->used - 1) * DIGIT_BIT; in mp_count_bits()
1584 q = a->dp[a->used - 1]; in mp_count_bits()
1606 if (b >= (int) (a->used * DIGIT_BIT)) { in mp_mod_2d()
1617 for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { in mp_mod_2d()
1738 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { in mp_div()
1741 q.used = a->used + 2; in mp_div()
1778 n = x.used - 1; in mp_div()
1779 t = y.used - 1; in mp_div()
1798 if (i > x.used) { in mp_div()
1829 t1.used = 2; in mp_div()
1838 t2.used = 3; in mp_div()
1875 x.sign = x.used == 0 ? MP_ZPOS : a->sign; in mp_div()
2027 digidx = X->used - 1; in s_mp_exptmod()
2143 if (a->used >= TOOM_SQR_CUTOFF) { in mp_sqr()
2149 if (a->used >= KARATSUBA_SQR_CUTOFF) { in mp_sqr()
2156 if ((a->used * 2 + 1) < MP_WARRAY && in mp_sqr()
2157 a->used < in mp_sqr()
2260 a->used = b / DIGIT_BIT + 1; in mp_2expt()
2277 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { in mp_reduce_setup()
2292 int res, um = m->used; in mp_reduce()
2383 MIN (a->used, b->used) < in s_mp_mul_digs()
2391 t.used = digs; in s_mp_mul_digs()
2394 pa = a->used; in s_mp_mul_digs()
2400 pb = MIN (b->used, digs - ix); in s_mp_mul_digs()
2470 pa = MIN(digs, a->used + b->used); in fast_s_mp_mul_digs()
2480 ty = MIN(b->used-1, ix); in fast_s_mp_mul_digs()
2490 iy = MIN(a->used-tx, ty+1); in fast_s_mp_mul_digs()
2506 olduse = c->used; in fast_s_mp_mul_digs()
2507 c->used = pa; in fast_s_mp_mul_digs()
2543 a->used = 0; in mp_init_size()
2565 pa = a->used; in s_mp_sqr()
2571 t.used = 2*pa + 1; in s_mp_sqr()
2635 if (((a->used + b->used + 1) < MP_WARRAY) in s_mp_mul_high_digs()
2636 && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { in s_mp_mul_high_digs()
2641 if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { in s_mp_mul_high_digs()
2644 t.used = a->used + b->used + 1; in s_mp_mul_high_digs()
2646 pa = a->used; in s_mp_mul_high_digs()
2647 pb = b->used; in s_mp_mul_high_digs()
2739 olduse = x->used; in fast_mp_montgomery_reduce()
2742 if (x->alloc < n->used + 1) { in fast_mp_montgomery_reduce()
2743 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { in fast_mp_montgomery_reduce()
2762 for (ix = 0; ix < x->used; ix++) { in fast_mp_montgomery_reduce()
2767 for (; ix < n->used * 2 + 1; ix++) { in fast_mp_montgomery_reduce()
2775 for (ix = 0; ix < n->used; ix++) { in fast_mp_montgomery_reduce()
2811 for (iy = 0; iy < n->used; iy++) { in fast_mp_montgomery_reduce()
2836 for (; ix <= n->used * 2 + 1; ix++) { in fast_mp_montgomery_reduce()
2851 _W = W + n->used; in fast_mp_montgomery_reduce()
2853 for (ix = 0; ix < n->used + 1; ix++) { in fast_mp_montgomery_reduce()
2866 x->used = n->used + 1; in fast_mp_montgomery_reduce()
2886 if (b->alloc < a->used + 1) { in mp_mul_2()
2887 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { in mp_mul_2()
2892 oldused = b->used; in mp_mul_2()
2893 b->used = a->used; in mp_mul_2()
2906 for (x = 0; x < a->used; x++) { in mp_mul_2()
2926 ++(b->used); in mp_mul_2()
2932 tmpb = b->dp + b->used; in mp_mul_2()
2933 for (x = b->used; x < oldused; x++) { in mp_mul_2()
2958 if (b->used > 1) { in mp_montgomery_calc_normalization()
2959 if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { in mp_montgomery_calc_normalization()
3062 if (((P->used * 2 + 1) < MP_WARRAY) && in mp_exptmod_fast()
3063 P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { in mp_exptmod_fast()
3160 digidx = X->used - 1; in mp_exptmod_fast()
3301 pa = a->used + a->used; in fast_s_mp_sqr()
3319 ty = MIN(a->used-1, ix); in fast_s_mp_sqr()
3329 iy = MIN(a->used-tx, ty+1); in fast_s_mp_sqr()
3358 olduse = b->used; in fast_s_mp_sqr()
3359 b->used = a->used+a->used; in fast_s_mp_sqr()
3389 if (c->alloc < a->used + 1) { in mp_mul_d()
3390 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { in mp_mul_d()
3396 olduse = c->used; in mp_mul_d()
3411 for (ix = 0; ix < a->used; ix++) { in mp_mul_d()
3432 c->used = a->used + 1; in mp_mul_d()