Lines Matching refs:mp_digit

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