diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-10 20:41:06 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-10 20:41:06 -0800 |
commit | 858859cf6fd6becef038cf4d9c1e650c3f2a9cc6 (patch) | |
tree | 081517aa9628b45d86e7fb1e139e3da996bdc89b /mpi-patches/mpi-set-double-intptr | |
parent | c940739b8f863f3331f00b36c23ad1526ab1147e (diff) | |
download | txr-858859cf6fd6becef038cf4d9c1e650c3f2a9cc6.tar.gz txr-858859cf6fd6becef038cf4d9c1e650c3f2a9cc6.tar.bz2 txr-858859cf6fd6becef038cf4d9c1e650c3f2a9cc6.zip |
Bignum support in mult function.
* arith.c: Regenerated.
* arith.txr (CNUM_BIT): New constant.
(bignum, bignum_dbl_ipt): New static functions.
(@{add-fname}): Use bignum function.
(mul): New functions, rewrite of mul from lib.c.
* lib.c (mul): Function removed.
* mpi-patches/add-mp-set-intptr (mp_set_intptr): Revised patch.
Local variable v should be int_ptr_t not unsigned long.
Also, the mp_set interface doesn't set the sign; it's an unsigned
interface. We must do that ourselves.
* mpi-patches/fix-mult-bug: The main multiplication function is
also broken in the same way, requiring the cast.
* mpi-patches/mpi-set-double-intptr: Fixed use of wrong type for
local variable v.
Diffstat (limited to 'mpi-patches/mpi-set-double-intptr')
-rw-r--r-- | mpi-patches/mpi-set-double-intptr | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mpi-patches/mpi-set-double-intptr b/mpi-patches/mpi-set-double-intptr index 1c834966..fb5dc52c 100644 --- a/mpi-patches/mpi-set-double-intptr +++ b/mpi-patches/mpi-set-double-intptr @@ -1,7 +1,7 @@ Index: mpi-1.8.6/mpi.c =================================================================== ---- mpi-1.8.6.orig/mpi.c 2011-12-10 18:21:53.000000000 -0800 -+++ mpi-1.8.6/mpi.c 2011-12-10 18:24:07.000000000 -0800 +--- mpi-1.8.6.orig/mpi.c 2011-12-10 19:13:25.000000000 -0800 ++++ mpi-1.8.6/mpi.c 2011-12-10 19:16:43.000000000 -0800 @@ -573,6 +573,36 @@ return MP_OKAY; } @@ -10,7 +10,7 @@ Index: mpi-1.8.6/mpi.c +mp_err mp_set_double_intptr(mp_int *mp, double_intptr_t z) +{ + int ix, shift; -+ unsigned long v = z > 0 ? z : -z; ++ double_intptr_t v = z > 0 ? z : -z; + const int nd = (sizeof v + sizeof (mp_digit) - 1) / sizeof (mp_digit); + + ARGCHK(mp != NULL, MP_BADARG); @@ -41,8 +41,8 @@ Index: mpi-1.8.6/mpi.c USED(mp) = 2; Index: mpi-1.8.6/mpi.h =================================================================== ---- mpi-1.8.6.orig/mpi.h 2011-12-10 18:21:53.000000000 -0800 -+++ mpi-1.8.6/mpi.h 2011-12-10 18:22:56.000000000 -0800 +--- mpi-1.8.6.orig/mpi.h 2011-12-10 19:13:25.000000000 -0800 ++++ mpi-1.8.6/mpi.h 2011-12-10 19:14:04.000000000 -0800 @@ -100,6 +100,9 @@ mp_err mp_set_int(mp_int *mp, long z); mp_err mp_set_intptr(mp_int *mp, int_ptr_t z); |