Lines Matching refs:mp_digit

155   if((DIGITS(mp) = s_mp_alloc(prec, sizeof(mp_digit), kmflag)) == NULL)
186 if((DIGITS(mp) = s_mp_alloc(ALLOC(from), sizeof(mp_digit), FLAG(from))) == NULL)
220 mp_digit *tmp;
234 if((tmp = s_mp_alloc(ALLOC(from), sizeof(mp_digit), FLAG(from))) == NULL)
340 void mp_set(mp_int *mp, mp_digit d)
366 if (sizeof v <= sizeof(mp_digit)) {
373 res = s_mp_add_d(mp, (mp_digit)((v >> (ix * CHAR_BIT)) & UCHAR_MAX));
400 if (sizeof z <= sizeof(mp_digit)) {
407 res = s_mp_add_d(mp, (mp_digit)((z >> (ix * CHAR_BIT)) & UCHAR_MAX));
429 mp_err mp_add_d(const mp_int *a, mp_digit d, mp_int *b)
473 mp_err mp_sub_d(const mp_int *a, mp_digit d, mp_int *b)
518 mp_err mp_mul_d(const mp_int *a, mp_digit d, mp_int *b)
567 mp_err mp_div_d(const mp_int *a, mp_digit d, mp_int *q, mp_digit *r)
571 mp_digit rem;
581 mp_digit mask;
583 mask = ((mp_digit)1 << pow) - 1;
645 mp_err mp_expt_d(const mp_int *a, mp_digit d, mp_int *c)
825 mp_digit *pb;
885 mp_digit b_i = *pb++;
922 mp_digit *pa;
923 mp_digit d;
1096 mp_err mp_div_2d(const mp_int *a, mp_digit d, mp_int *q, mp_int *r)
1136 mp_digit d;
1205 mp_err mp_2expt(mp_int *a, mp_digit k)
1283 mp_err mp_mod_d(const mp_int *a, mp_digit d, mp_digit *c)
1286 mp_digit rem;
1511 mp_digit d;
1593 mp_err mp_exptmod_d(const mp_int *a, mp_digit d, const mp_int *m, mp_int *c)
1669 int mp_cmp_d(const mp_int *a, mp_digit d)
2044 mp_digit d;
2163 mp_digit s_mp_invmod_radix(mp_digit P)
2165 mp_digit T = P;
2185 mp_digit r;
2204 mp_digit v = r * MP_DIGIT(x, ix);
2206 v &= ((mp_digit)1 << j) - 1; /* v = v mod (2 ** j) */
2298 static const mp_digit d2 = 2;
2299 static const mp_int two = { 0, MP_ZPOS, 1, 1, (mp_digit *)&d2 };
2304 mp_digit i = s_mp_invmod_radix(MP_DIGIT(a,0));
2306 i &= ((mp_digit)1 << k) - (mp_digit)1;
2357 /*static const mp_digit d1 = 1; */
2358 /*static const mp_int one = { MP_ZPOS, 1, 1, (mp_digit *)&d1 }; */
2533 return (USED(mp) * sizeof(mp_digit)) + 1;
2551 mp_digit d = DIGIT(mp, ix);
2554 for(jx = sizeof(mp_digit) - 1; jx >= 0; jx--) {
2694 mp_digit rem, rdx = (mp_digit)radix;
2793 mp_digit *tmp;
2798 if((tmp = s_mp_alloc(min, sizeof(mp_digit), FLAG(mp))) == NULL)
2847 void s_mp_setz(mp_digit *dp, mp_size count)
2855 memset(dp, 0, count * sizeof(mp_digit));
2867 void s_mp_copy(const mp_digit *sp, mp_digit *dp, mp_size count)
2875 memcpy(dp, sp, count * sizeof(mp_digit));
2910 kmem_free(ptr, alloc * sizeof (mp_digit));
3001 mp_err s_mp_mul_2d(mp_int *mp, mp_digit d)
3004 mp_digit dshift, bshift;
3005 mp_digit mask;
3012 mask = ((mp_digit)~0 << (MP_DIGIT_BIT - bshift));
3022 mp_digit *pa = MP_DIGITS(mp);
3023 mp_digit *alim = pa + MP_USED(mp);
3024 mp_digit prev = 0;
3027 mp_digit x = *pa;
3048 mp_digit *src, *dst;
3096 mp_digit *pd;
3098 mp_digit kin = 0;
3104 mp_digit d = *pd;
3134 void s_mp_mod_2d(mp_int *mp, mp_digit d)
3138 mp_digit dmask;
3144 dmask = ((mp_digit)1 << nbit) - 1;
3164 void s_mp_div_2d(mp_int *mp, mp_digit d)
3167 mp_digit save, next, mask;
3172 mask = ((mp_digit)1 << d) - 1;
3199 mp_err s_mp_norm(mp_int *a, mp_int *b, mp_digit *pd)
3201 mp_digit d;
3202 mp_digit mask;
3203 mp_digit b_msd;
3234 mp_err s_mp_add_d(mp_int *mp, mp_digit d) /* unsigned digit addition */
3257 DIGIT(mp, ix) = (mp_digit)k;
3262 mp_digit * pmp = MP_DIGITS(mp);
3263 mp_digit sum, mp_i, carry = 0;
3291 mp_err s_mp_sub_d(mp_int *mp, mp_digit d) /* unsigned digit subtract */
3319 mp_digit *pmp = MP_DIGITS(mp);
3320 mp_digit mp_i, diff, borrow;
3341 mp_err s_mp_mul_d(mp_int *a, mp_digit d)
3354 return s_mp_mul_2d(a, (mp_digit)pow);
3380 mp_err s_mp_div_d(mp_int *mp, mp_digit d, mp_digit *r)
3385 mp_digit w, q;
3401 mp_digit n = MP_DIGIT(mp,0);
3402 mp_digit rem;
3429 DIGIT(&quot, 0) = (mp_digit)q;
3433 mp_digit p;
3435 mp_digit norm;
3474 *r = (mp_digit)w;
3500 mp_digit d, sum, carry = 0;
3502 mp_digit *pa, *pb;
3564 DIGIT(a, ix) = (mp_digit)w;
3583 mp_digit *pa, *pb, *pc;
3587 mp_digit sum, carry = 0, d;
3652 DIGIT(c, used) = (mp_digit)w;
3675 mp_digit d, sum, carry = 0;
3735 DIGIT(a, ia) = (mp_digit)k;
3758 mp_digit *pa, *pb, *limit;
3762 mp_digit d, diff, borrow = 0;
3824 mp_digit *pa, *pb, *pc;
3828 mp_digit d, diff, borrow = 0;
3905 Plo = (mp_digit)product; \
3906 Phi = (mp_digit)(product >> MP_DIGIT_BIT); }
3913 { mp_digit a0b1, a1b0; \
3931 void s_mpv_mul_d(const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)
3934 mp_digit d = 0;
3944 mp_digit carry = 0;
3946 mp_digit a_i = *a++;
3947 mp_digit a0b0, a1b1;
3962 void s_mpv_mul_d_add(const mp_digit *a, mp_size a_len, mp_digit b,
3963 mp_digit *c)
3966 mp_digit d = 0;
3976 mp_digit carry = 0;
3978 mp_digit a_i = *a++;
3979 mp_digit a0b0, a1b1;
3998 void s_mpv_mul_d_add_prop(const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)
4001 mp_digit d = 0;
4016 mp_digit carry = 0;
4018 mp_digit a_i = *a++;
4019 mp_digit a0b0, a1b1;
4035 mp_digit c_i = *c;
4048 Plo = (mp_digit)square; \
4049 Phi = (mp_digit)(square >> MP_DIGIT_BIT); }
4056 { mp_digit Pmid; \
4070 void s_mpv_sqr_add_prop(const mp_digit *pa, mp_size a_len, mp_digit *ps)
4074 mp_digit d;
4110 mp_digit carry = 0;
4112 mp_digit a_i = *pa++;
4113 mp_digit a0a0, a1a1;
4132 mp_digit s_i = *ps;
4147 mp_err s_mpv_div_2dx1d(mp_digit Nhi, mp_digit Nlo, mp_digit divisor,
4148 mp_digit *qp, mp_digit *rp)
4150 mp_digit d1, d0, q1, q0;
4151 mp_digit r1, r0, m;
4221 mp_digit q_msd;
4224 mp_digit d;
4225 mp_digit div_msd;
4234 s_mp_div_2d(quot, (mp_digit)ix);
4235 s_mp_mod_2d(rem, (mp_digit)ix);
4287 mp_digit r;
4302 MP_CHECKOK( s_mp_mul_d(&t, (mp_digit)q_msd) );
4329 MP_DIGIT(quot, unusedRem) = (mp_digit)q_msd;
4351 mp_err s_mp_2expt(mp_int *a, mp_digit k)
4363 DIGIT(a, dig) |= ((mp_digit)1 << bit);
4452 mp_digit *pa, *pb;
4453 mp_digit da = 0, db = 0;
4488 int s_mp_cmp_d(const mp_int *a, mp_digit d)
4512 mp_digit d;
4536 int s_mp_ispow2d(mp_digit d)
4578 #error "unknown type for mp_digit"
4644 char s_mp_todigit(mp_digit val, int r, int low)
4690 mp_digit d;
4696 count = len % sizeof(mp_digit);
4705 for(; len > 0; len -= sizeof(mp_digit)) {
4706 for (d = 0, count = sizeof(mp_digit); count > 0; --count) {
4728 mp_digit d = 0;
4733 bytes = (USED(mp) * sizeof(mp_digit));
4747 for(ix = sizeof(mp_digit) - 1; ix >= 0; ix--) {
4772 mp_digit d = DIGIT(mp, ix);
4776 for(jx = sizeof(mp_digit) - 1; jx >= 0; jx--) {
4804 mp_digit d = DIGIT(mp, ix);
4808 for(jx = sizeof(mp_digit) - 1; jx >= 0; jx--) {
4849 mp_digit d = DIGIT(mp, ix);
4853 for(jx = sizeof(mp_digit) - 1; jx >= 0; jx--) {