summaryrefslogtreecommitdiffstats
path: root/mpi-patches/mpi-set-mpi-word
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-10 17:47:04 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-10 17:47:04 -0800
commitb5b4ad71a0775c9c9e30edfc4758ebc34631282b (patch)
treef7a2c5d5f572e88fe6a30b13a804575de5ffaa3e /mpi-patches/mpi-set-mpi-word
parent497cd7dee0ca67644d92eeefac277e89361d3053 (diff)
downloadtxr-b5b4ad71a0775c9c9e30edfc4758ebc34631282b.tar.gz
txr-b5b4ad71a0775c9c9e30edfc4758ebc34631282b.tar.bz2
txr-b5b4ad71a0775c9c9e30edfc4758ebc34631282b.zip
Adding mp_set_word function.
* mpi-patches/series (mpi-set-mpi-word): New patch. * mpi-patches/mpi-set-mpi-word: New file.
Diffstat (limited to 'mpi-patches/mpi-set-mpi-word')
-rw-r--r--mpi-patches/mpi-set-mpi-word32
1 files changed, 32 insertions, 0 deletions
diff --git a/mpi-patches/mpi-set-mpi-word b/mpi-patches/mpi-set-mpi-word
new file mode 100644
index 00000000..acd37285
--- /dev/null
+++ b/mpi-patches/mpi-set-mpi-word
@@ -0,0 +1,32 @@
+Index: mpi-1.8.6/mpi.c
+===================================================================
+--- mpi-1.8.6.orig/mpi.c 2011-12-10 17:41:38.000000000 -0800
++++ mpi-1.8.6/mpi.c 2011-12-10 17:44:35.000000000 -0800
+@@ -573,6 +573,15 @@
+ 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_MAX;
++ SIGN(mp) = sign;
++ return MP_OK;
++}
++
+ /*------------------------------------------------------------------------*/
+ /* {{{ Digit arithmetic */
+
+Index: mpi-1.8.6/mpi.h
+===================================================================
+--- mpi-1.8.6.orig/mpi.h 2011-12-10 17:41:38.000000000 -0800
++++ mpi-1.8.6/mpi.h 2011-12-10 17:43:56.000000000 -0800
+@@ -100,6 +100,7 @@
+ 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 */