diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-04-22 19:54:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-04-22 19:54:34 -0700 |
commit | 0ee6428c2ddf94b758bf6005f1bae593c7a0366c (patch) | |
tree | 9c695a34510530416e150c2da57ee7f88189ab6d /mpi/mpi.c | |
parent | c5bdf7627cd12d134ea2e8bccb78440576bfd8e8 (diff) | |
download | txr-0ee6428c2ddf94b758bf6005f1bae593c7a0366c.tar.gz txr-0ee6428c2ddf94b758bf6005f1bae593c7a0366c.tar.bz2 txr-0ee6428c2ddf94b758bf6005f1bae593c7a0366c.zip |
mpi-set-mpi-word patch
* mpi/mpi.c (mp_set_word): New function.
* mpi/mpi.h (mp_set_word): Declared.
Diffstat (limited to 'mpi/mpi.c')
-rw-r--r-- | mpi/mpi.c | 9 |
1 files changed, 9 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 */ |