summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-12 22:01:52 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-12 22:01:52 -0800
commit5a9bf359b9aca63f5eb26f5a371b0fae7dd353b4 (patch)
tree1dcf9463ed92bf267ec6be339dbfcff514d34257
parent705896d8c9d738de984e593a67ec008a16736276 (diff)
downloadtxr-5a9bf359b9aca63f5eb26f5a371b0fae7dd353b4.tar.gz
txr-5a9bf359b9aca63f5eb26f5a371b0fae7dd353b4.tar.bz2
txr-5a9bf359b9aca63f5eb26f5a371b0fae7dd353b4.zip
* mpi-patches/bit-search-optimizations (s_highest_bit): Added static
storage class specifier. * mpi-patches/fix-mult-bug (s_mp_sqr): More braindamage found in MPI. This function performs additions and multiplication mp_digit, expecting a mp_word precision result without casting. This function is needed for exponentiation.
-rw-r--r--ChangeLog10
-rw-r--r--mpi-patches/bit-search-optimizations6
-rw-r--r--mpi-patches/fix-mult-bug29
3 files changed, 41 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ca49b56e..efd15251 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-12-12 Kaz Kylheku <kaz@kylheku.com>
+ * mpi-patches/bit-search-optimizations (s_highest_bit): Added static
+ storage class specifier.
+
+ * mpi-patches/fix-mult-bug (s_mp_sqr): More braindamage found in MPI.
+ This function performs additions and multiplication mp_digit,
+ expecting a mp_word precision result without casting. This function
+ is needed for exponentiation.
+
+2011-12-12 Kaz Kylheku <kaz@kylheku.com>
+
Git rid of some some loops in MPI where it is searching for
the highest bit, replacing them with an adapation of the
bit searching function used in arith.c.
diff --git a/mpi-patches/bit-search-optimizations b/mpi-patches/bit-search-optimizations
index ea283a3e..d9b4357d 100644
--- a/mpi-patches/bit-search-optimizations
+++ b/mpi-patches/bit-search-optimizations
@@ -1,12 +1,12 @@
Index: mpi-1.8.6/mpi.c
===================================================================
---- mpi-1.8.6.orig/mpi.c 2011-12-12 21:08:44.000000000 -0800
-+++ mpi-1.8.6/mpi.c 2011-12-12 21:34:32.000000000 -0800
+--- mpi-1.8.6.orig/mpi.c 2011-12-12 21:55:35.000000000 -0800
++++ mpi-1.8.6/mpi.c 2011-12-12 21:55:45.000000000 -0800
@@ -2908,6 +2908,218 @@
/* }}} */
-+int s_highest_bit(mp_digit n)
++static int s_highest_bit(mp_digit n)
+{
+#if MP_DIGIT_SIZE == 8
+ if (n & 0x7FFFFFFF00000000) {
diff --git a/mpi-patches/fix-mult-bug b/mpi-patches/fix-mult-bug
index 78bc59b1..a894eefe 100644
--- a/mpi-patches/fix-mult-bug
+++ b/mpi-patches/fix-mult-bug
@@ -1,7 +1,7 @@
Index: mpi-1.8.6/mpi.c
===================================================================
--- mpi-1.8.6.orig/mpi.c 2011-12-10 19:43:20.000000000 -0800
-+++ mpi-1.8.6/mpi.c 2011-12-12 14:31:12.000000000 -0800
++++ mpi-1.8.6/mpi.c 2011-12-12 21:55:28.000000000 -0800
@@ -3255,7 +3255,7 @@
unless absolutely necessary.
*/
@@ -29,3 +29,30 @@ Index: mpi-1.8.6/mpi.c
*pt = ACCUM(w);
k = CARRYOUT(w);
}
+@@ -3562,7 +3562,7 @@
+ if(*pa1 == 0)
+ continue;
+
+- w = DIGIT(&tmp, ix + ix) + (*pa1 * *pa1);
++ w = DIGIT(&tmp, ix + ix) + (*pa1 * (mp_word) *pa1);
+
+ pbt[ix + ix] = ACCUM(w);
+ k = CARRYOUT(w);
+@@ -3584,7 +3584,7 @@
+ pt = pbt + ix + jx;
+
+ /* Compute the multiplicative step */
+- w = *pa1 * *pa2;
++ w = *pa1 * (mp_word) *pa2;
+
+ /* If w is more than half MP_WORD_MAX, the doubling will
+ overflow, and we need to record a carry out into the next
+@@ -3628,7 +3628,7 @@
+ */
+ kx = 1;
+ while(k) {
+- k = pbt[ix + jx + kx] + 1;
++ k = (mp_word) pbt[ix + jx + kx] + 1;
+ pbt[ix + jx + kx] = ACCUM(k);
+ k = CARRYOUT(k);
+ ++kx;