Lines Matching refs:sqr
908 /* {{{ mp_sqr(a, sqr) */
919 /* sqr = a^2; Caller provides both a and tmp; */
920 mp_err mp_sqr(const mp_int *a, mp_int *sqr)
929 ARGCHK(a != NULL && sqr != NULL, MP_BADARG);
931 if (a == sqr) {
941 if (ix > MP_ALLOC(sqr)) {
942 MP_USED(sqr) = 1;
943 MP_CHECKOK( s_mp_grow(sqr, ix) );
945 MP_USED(sqr) = ix;
946 MP_DIGIT(sqr, 0) = 0;
951 s_mp_sqr_comba_4(a, sqr);
955 s_mp_sqr_comba_8(a, sqr);
959 s_mp_sqr_comba_16(a, sqr);
963 s_mp_sqr_comba_32(a, sqr);
973 s_mpv_mul_d(pa, count, d, MP_DIGITS(sqr) + 1);
976 s_mpv_mul_d_add(pa, count, d, MP_DIGITS(sqr) + ix);
978 MP_DIGIT(sqr, MP_USED(sqr)-1) = 0; /* above loop stopped short of this. */
980 /* now sqr *= 2 */
981 s_mp_mul_2(sqr);
983 MP_DIGIT(sqr, 1) = 0;
986 /* now add the squares of the digits of a to sqr. */
987 s_mpv_sqr_add_prop(MP_DIGITS(a), MP_USED(a), MP_DIGITS(sqr));
989 SIGN(sqr) = ZPOS;
990 s_mp_clamp(sqr);