Lines Matching full:used
119 int used, alloc, sign;
125 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
126 #define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
127 #define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
131 #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
193 /* reverse an array, used for radix code */
220 if (a->used > b->used) {
221 min = b->used;
222 max = a->used;
225 min = a->used;
226 max = b->used;
237 /* get old used digit count and set new one */
238 olduse = c->used;
239 c->used = max + 1;
289 for (i = c->used; i < olduse; i++) {
305 min = b->used;
306 max = a->used;
314 olduse = c->used;
315 c->used = max;
355 /* clear digits above used (since we may not have grown result above) */
356 for (i = c->used; i < olduse; i++) {
382 /* set the used to zero, allocated digits to the default precision
384 a->used = 0;
400 for (i = 0; i < a->used; i++) {
409 a->alloc = a->used = 0;
492 if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) {
498 if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) {
505 * The fast multiplier can be used if the output will
510 int digs = a->used + b->used + 1;
513 MIN(a->used, b->used) <=
526 c->sign = (c->used > 0) ? neg : MP_ZPOS;
708 if (a->used > 1) {
925 if (a->used > b->used) {
929 if (a->used < b->used) {
934 tmpa = a->dp + (a->used - 1);
937 tmpb = b->dp + (a->used - 1);
940 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) {
976 a->used += 1;
980 a->used += 2;
1068 tmpc = c->dp + (c->used - 1);
1072 for (x = c->used - 1; x >= 0; x--) {
1111 a->used = 0;
1131 if (b->alloc < a->used) {
1132 if ((res = mp_grow (b, a->used)) != MP_OKAY) {
1150 for (n = 0; n < a->used; n++) {
1155 for (; n < b->used; n++) {
1160 /* copy used count and sign */
1161 b->used = a->used;
1177 /* if b > used then simply zero it and return */
1178 if (a->used <= b) {
1204 for (x = 0; x < (a->used - b); x++) {
1209 for (; x < a->used; x++) {
1215 a->used -= b;
1234 * This is used to ensure that leading zero digits are
1235 * trimed and the leading "used" digit will be non-zero
1241 /* decrease used while the most significant digit is
1244 while (a->used > 0 && a->dp[a->used - 1] == 0) {
1245 --(a->used);
1248 /* reset the sign flag if used == 0 */
1249 if (a->used == 0) {
1321 a->used = (a->dp[0] != 0) ? 1 : 0;
1332 if (b->alloc < a->used) {
1333 if ((res = mp_grow (b, a->used)) != MP_OKAY) {
1338 oldused = b->used;
1339 b->used = a->used;
1344 tmpa = a->dp + b->used - 1;
1347 tmpb = b->dp + b->used - 1;
1351 for (x = b->used - 1; x >= 0; x--) {
1363 tmpb = b->dp + b->used;
1364 for (x = b->used; x < oldused; x++) {
1388 if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) {
1389 if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) {
1418 for (x = 0; x < c->used; x++) {
1432 c->dp[(c->used)++] = r;
1504 if (a->alloc < a->used + b) {
1505 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) {
1513 /* increment the used by the shift amount then copy upwards */
1514 a->used += b;
1517 top = a->dp + a->used - 1;
1520 bottom = a->dp + a->used - 1 - b;
1526 for (x = a->used - 1; x >= b; x--) {
1547 if (a->used == 0) {
1552 r = (a->used - 1) * DIGIT_BIT;
1555 q = a->dp[a->used - 1];
1576 if (b >= (int) (a->used * DIGIT_BIT)) {
1587 for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) {
1706 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) {
1709 q.used = a->used + 2;
1745 /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */
1746 n = x.used - 1;
1747 t = y.used - 1;
1766 if (i > x.used) {
1797 t1.used = 2;
1806 t2.used = 3;
1843 x.sign = x.used == 0 ? MP_ZPOS : a->sign;
1923 /* create mu, used for Barrett reduction */
1994 digidx = X->used - 1;
2017 * does lower the # of trivial squaring/reductions used
2109 if (a->used >= TOOM_SQR_CUTOFF) {
2115 if (a->used >= KARATSUBA_SQR_CUTOFF) {
2122 if ((a->used * 2 + 1) < MP_WARRAY &&
2123 a->used <
2222 /* set the used count of where the bit will go */
2223 a->used = b / DIGIT_BIT + 1;
2239 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) {
2253 int res, um = m->used;
2344 MIN (a->used, b->used) <
2353 t.used = digs;
2356 pa = a->used;
2362 pb = MIN (b->used, digs - ix);
2365 /* copy of the digit from a used within the nested loop */
2432 pa = MIN(digs, a->used + b->used);
2443 ty = MIN(b->used-1, ix);
2451 while (tx++ < a->used && ty-- >= 0) { ... }
2453 iy = MIN(a->used-tx, ty+1);
2469 olduse = c->used;
2470 c->used = pa;
2506 a->used = 0;
2527 pa = a->used;
2532 /* default used is maximum possible size */
2533 t.used = 2*pa + 1;
2596 if (((a->used + b->used + 1) < MP_WARRAY)
2597 && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
2602 if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) {
2605 t.used = a->used + b->used + 1;
2607 pa = a->used;
2608 pb = b->used;
2698 /* get old used count */
2699 olduse = x->used;
2702 if (x->alloc < n->used + 1) {
2703 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) {
2721 /* copy the digits of a into W[0..a->used-1] */
2722 for (ix = 0; ix < x->used; ix++) {
2726 /* zero the high words of W[a->used..m->used*2] */
2727 for (; ix < n->used * 2 + 1; ix++) {
2735 for (ix = 0; ix < n->used; ix++) {
2757 * first m->used words of W[] have the carries fixed
2771 for (iy = 0; iy < n->used; iy++) {
2796 for (; ix <= n->used * 2 + 1; ix++) {
2811 _W = W + n->used;
2813 for (ix = 0; ix < n->used + 1; ix++) {
2818 * m->used+1 we'll have to clear the digits
2825 /* set the max used and clamp */
2826 x->used = n->used + 1;
2845 if (b->alloc < a->used + 1) {
2846 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) {
2851 oldused = b->used;
2852 b->used = a->used;
2865 for (x = 0; x < a->used; x++) {
2885 ++(b->used);
2891 tmpb = b->dp + b->used;
2892 for (x = b->used; x < oldused; x++) {
2916 if (b->used > 1) {
2917 if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) {
3019 if (((P->used * 2 + 1) < MP_WARRAY) &&
3020 P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {
3117 digidx = X->used - 1;
3140 * does lower the # of trivial squaring/reductions used
3214 /* fixup result if Montgomery reduction is used
3257 pa = a->used + a->used;
3275 ty = MIN(a->used-1, ix);
3283 while (tx++ < a->used && ty-- >= 0) { ... }
3285 iy = MIN(a->used-tx, ty+1);
3314 olduse = b->used;
3315 b->used = a->used+a->used;
3345 if (c->alloc < a->used + 1) {
3346 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) {
3351 /* get the original destinations used count */
3352 olduse = c->used;
3367 for (ix = 0; ix < a->used; ix++) {
3387 /* set used count */
3388 c->used = a->used + 1;