diff options
Diffstat (limited to 'mpi')
-rw-r--r-- | mpi/mpi.c | 9 | ||||
-rw-r--r-- | mpi/mpi.h | 1 |
2 files changed, 10 insertions, 0 deletions
@@ -571,6 +571,15 @@ mp_err mp_get_intptr(mp_int *mp, int_ptr_t *z) return MP_OKAY; } +mp_err mp_set_word(mp_int *mp, mp_word w, int sign) +{ + USED(mp) = 2; + DIGIT(mp, 0) = w & MP_DIGIT_MAX; + DIGIT(mp, 1) = w >> MP_DIGIT_BIT; + SIGN(mp) = sign; + return MP_OKAY; +} + /*------------------------------------------------------------------------*/ /* {{{ Digit arithmetic */ @@ -100,6 +100,7 @@ void mp_set(mp_int *mp, mp_digit d); mp_err mp_set_int(mp_int *mp, long z); mp_err mp_set_intptr(mp_int *mp, int_ptr_t z); mp_err mp_get_intptr(mp_int *mp, int_ptr_t *z); +mp_err mp_set_word(mp_int *mp, mp_word w, int sign); /*------------------------------------------------------------------------*/ /* Single digit arithmetic */ |