Lines Matching defs:from
169 /* {{{ mp_init_copy(mp, from) */
172 mp_init_copy(mp, from)
174 Initialize mp as an exact copy of from. Returns MP_OKAY if
179 mp_err mp_init_copy(mp_int *mp, const mp_int *from)
181 ARGCHK(mp != NULL && from != NULL, MP_BADARG);
183 if(mp == from)
186 if((DIGITS(mp) = s_mp_alloc(ALLOC(from), sizeof(mp_digit), FLAG(from))) == NULL)
189 s_mp_copy(DIGITS(from), DIGITS(mp), USED(from));
190 USED(mp) = USED(from);
191 ALLOC(mp) = ALLOC(from);
192 SIGN(mp) = SIGN(from);
193 FLAG(mp) = FLAG(from);
201 /* {{{ mp_copy(from, to) */
204 mp_copy(from, to)
206 Copies the mp_int 'from' to the mp_int 'to'. It is presumed that
208 instead). If 'from' and 'to' are identical, nothing happens.
211 mp_err mp_copy(const mp_int *from, mp_int *to)
213 ARGCHK(from != NULL && to != NULL, MP_BADARG);
215 if(from == to)
224 all the used digits of 'from', we'll re-use it to avoid hitting
229 if(ALLOC(to) >= USED(from)) {
230 s_mp_setz(DIGITS(to) + USED(from), ALLOC(to) - USED(from));
231 s_mp_copy(DIGITS(from), DIGITS(to), USED(from));
234 if((tmp = s_mp_alloc(ALLOC(from), sizeof(mp_digit), FLAG(from))) == NULL)
237 s_mp_copy(DIGITS(from), tmp, USED(from));
247 ALLOC(to) = ALLOC(from);
250 /* Copy the precision and sign from the original */
251 USED(to) = USED(from);
252 SIGN(to) = SIGN(from);
253 FLAG(to) = FLAG(from);
2089 ** This technique from the paper "Fast Modular Reciprocals" (unpublished)
2160 ** This technique from the paper "Fast Modular Reciprocals" (unpublished)
2179 ** This technique from the paper "Fast Modular Reciprocals" (unpublished)
2507 /* Get sign from first byte */
2570 Read an integer from the given string, and set mp to the resulting
2866 /* Copy 'count' digits from sp to dp */
2923 /* Remove leading zeroes from the given value */
3109 /* Deal with rollover from last digit */
3290 /* Subtract d from |mp| in place, assumes |mp| > d */
4145 ** so its high bit is 1. This code is from NSPR.
4381 This algorithm was derived from the _Handbook of Applied