Lines Matching refs:used
127 int used, alloc, sign; member
133 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
134 #define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
135 #define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
139 #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
228 if (a->used > b->used) { in s_mp_add()
229 min = b->used; in s_mp_add()
230 max = a->used; in s_mp_add()
233 min = a->used; in s_mp_add()
234 max = b->used; in s_mp_add()
246 olduse = c->used; in s_mp_add()
247 c->used = max + 1; in s_mp_add()
297 for (i = c->used; i < olduse; i++) { in s_mp_add()
313 min = b->used; in s_mp_sub()
314 max = a->used; in s_mp_sub()
322 olduse = c->used; in s_mp_sub()
323 c->used = max; in s_mp_sub()
364 for (i = c->used; i < olduse; i++) { in s_mp_sub()
392 a->used = 0; in mp_init()
408 for (i = 0; i < a->used; i++) { in mp_clear()
417 a->alloc = a->used = 0; in mp_clear()
500 if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { in mp_mul()
506 if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { in mp_mul()
518 int digs = a->used + b->used + 1; in mp_mul()
521 MIN(a->used, b->used) <= in mp_mul()
534 c->sign = (c->used > 0) ? neg : MP_ZPOS; in mp_mul()
716 if (a->used > 1) { in mp_cmp_d()
933 if (a->used > b->used) { in mp_cmp_mag()
937 if (a->used < b->used) { in mp_cmp_mag()
942 tmpa = a->dp + (a->used - 1); in mp_cmp_mag()
945 tmpb = b->dp + (a->used - 1); in mp_cmp_mag()
948 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { in mp_cmp_mag()
984 a->used += 1; in mp_read_unsigned_bin()
988 a->used += 2; in mp_read_unsigned_bin()
1076 tmpc = c->dp + (c->used - 1); in mp_div_2d()
1080 for (x = c->used - 1; x >= 0; x--) { in mp_div_2d()
1119 a->used = 0; in mp_zero()
1139 if (b->alloc < a->used) { in mp_copy()
1140 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_copy()
1158 for (n = 0; n < a->used; n++) { in mp_copy()
1163 for (; n < b->used; n++) { in mp_copy()
1169 b->used = a->used; in mp_copy()
1186 if (a->used <= b) { in mp_rshd()
1212 for (x = 0; x < (a->used - b); x++) { in mp_rshd()
1217 for (; x < a->used; x++) { in mp_rshd()
1223 a->used -= b; in mp_rshd()
1252 while (a->used > 0 && a->dp[a->used - 1] == 0) { in mp_clamp()
1253 --(a->used); in mp_clamp()
1257 if (a->used == 0) { in mp_clamp()
1329 a->used = (a->dp[0] != 0) ? 1 : 0; in mp_set()
1340 if (b->alloc < a->used) { in mp_div_2()
1341 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_div_2()
1346 oldused = b->used; in mp_div_2()
1347 b->used = a->used; in mp_div_2()
1352 tmpa = a->dp + b->used - 1; in mp_div_2()
1355 tmpb = b->dp + b->used - 1; in mp_div_2()
1359 for (x = b->used - 1; x >= 0; x--) { in mp_div_2()
1371 tmpb = b->dp + b->used; in mp_div_2()
1372 for (x = b->used; x < oldused; x++) { in mp_div_2()
1396 if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { in mp_mul_2d()
1397 if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { in mp_mul_2d()
1426 for (x = 0; x < c->used; x++) { in mp_mul_2d()
1440 c->dp[(c->used)++] = r; in mp_mul_2d()
1512 if (a->alloc < a->used + b) { in mp_lshd()
1513 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { in mp_lshd()
1522 a->used += b; in mp_lshd()
1525 top = a->dp + a->used - 1; in mp_lshd()
1528 bottom = a->dp + a->used - 1 - b; in mp_lshd()
1534 for (x = a->used - 1; x >= b; x--) { in mp_lshd()
1555 if (a->used == 0) { in mp_count_bits()
1560 r = (a->used - 1) * DIGIT_BIT; in mp_count_bits()
1563 q = a->dp[a->used - 1]; in mp_count_bits()
1584 if (b >= (int) (a->used * DIGIT_BIT)) { in mp_mod_2d()
1595 for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { in mp_mod_2d()
1714 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { in mp_div()
1717 q.used = a->used + 2; in mp_div()
1754 n = x.used - 1; in mp_div()
1755 t = y.used - 1; in mp_div()
1774 if (i > x.used) { in mp_div()
1805 t1.used = 2; in mp_div()
1814 t2.used = 3; in mp_div()
1851 x.sign = x.used == 0 ? MP_ZPOS : a->sign; in mp_div()
2002 digidx = X->used - 1; in s_mp_exptmod()
2117 if (a->used >= TOOM_SQR_CUTOFF) { in mp_sqr()
2123 if (a->used >= KARATSUBA_SQR_CUTOFF) { in mp_sqr()
2130 if ((a->used * 2 + 1) < MP_WARRAY && in mp_sqr()
2131 a->used < in mp_sqr()
2231 a->used = b / DIGIT_BIT + 1; in mp_2expt()
2247 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { in mp_reduce_setup()
2261 int res, um = m->used; in mp_reduce()
2352 MIN (a->used, b->used) < in s_mp_mul_digs()
2361 t.used = digs; in s_mp_mul_digs()
2364 pa = a->used; in s_mp_mul_digs()
2370 pb = MIN (b->used, digs - ix); in s_mp_mul_digs()
2440 pa = MIN(digs, a->used + b->used); in fast_s_mp_mul_digs()
2451 ty = MIN(b->used-1, ix); in fast_s_mp_mul_digs()
2461 iy = MIN(a->used-tx, ty+1); in fast_s_mp_mul_digs()
2477 olduse = c->used; in fast_s_mp_mul_digs()
2478 c->used = pa; in fast_s_mp_mul_digs()
2514 a->used = 0; in mp_init_size()
2535 pa = a->used; in s_mp_sqr()
2541 t.used = 2*pa + 1; in s_mp_sqr()
2604 if (((a->used + b->used + 1) < MP_WARRAY) in s_mp_mul_high_digs()
2605 && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { in s_mp_mul_high_digs()
2610 if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { in s_mp_mul_high_digs()
2613 t.used = a->used + b->used + 1; in s_mp_mul_high_digs()
2615 pa = a->used; in s_mp_mul_high_digs()
2616 pb = b->used; in s_mp_mul_high_digs()
2707 olduse = x->used; in fast_mp_montgomery_reduce()
2710 if (x->alloc < n->used + 1) { in fast_mp_montgomery_reduce()
2711 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { in fast_mp_montgomery_reduce()
2730 for (ix = 0; ix < x->used; ix++) { in fast_mp_montgomery_reduce()
2735 for (; ix < n->used * 2 + 1; ix++) { in fast_mp_montgomery_reduce()
2743 for (ix = 0; ix < n->used; ix++) { in fast_mp_montgomery_reduce()
2779 for (iy = 0; iy < n->used; iy++) { in fast_mp_montgomery_reduce()
2804 for (; ix <= n->used * 2 + 1; ix++) { in fast_mp_montgomery_reduce()
2819 _W = W + n->used; in fast_mp_montgomery_reduce()
2821 for (ix = 0; ix < n->used + 1; ix++) { in fast_mp_montgomery_reduce()
2834 x->used = n->used + 1; in fast_mp_montgomery_reduce()
2853 if (b->alloc < a->used + 1) { in mp_mul_2()
2854 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { in mp_mul_2()
2859 oldused = b->used; in mp_mul_2()
2860 b->used = a->used; in mp_mul_2()
2873 for (x = 0; x < a->used; x++) { in mp_mul_2()
2893 ++(b->used); in mp_mul_2()
2899 tmpb = b->dp + b->used; in mp_mul_2()
2900 for (x = b->used; x < oldused; x++) { in mp_mul_2()
2924 if (b->used > 1) { in mp_montgomery_calc_normalization()
2925 if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { in mp_montgomery_calc_normalization()
3027 if (((P->used * 2 + 1) < MP_WARRAY) && in mp_exptmod_fast()
3028 P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { in mp_exptmod_fast()
3125 digidx = X->used - 1; in mp_exptmod_fast()
3265 pa = a->used + a->used; in fast_s_mp_sqr()
3283 ty = MIN(a->used-1, ix); in fast_s_mp_sqr()
3293 iy = MIN(a->used-tx, ty+1); in fast_s_mp_sqr()
3322 olduse = b->used; in fast_s_mp_sqr()
3323 b->used = a->used+a->used; in fast_s_mp_sqr()
3353 if (c->alloc < a->used + 1) { in mp_mul_d()
3354 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { in mp_mul_d()
3360 olduse = c->used; in mp_mul_d()
3375 for (ix = 0; ix < a->used; ix++) { in mp_mul_d()
3396 c->used = a->used + 1; in mp_mul_d()