summaryrefslogtreecommitdiffstats
path: root/mpi-patches/add-mp-hash
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-04-09 09:04:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-04-09 09:04:31 -0700
commit405e7884dd00bfdac508d93851d898b5f7d5e4e1 (patch)
tree4017912bd763d3d750de4ea5b391ee45d8a28db6 /mpi-patches/add-mp-hash
parent1928aa26ceab8601049565a9064d68ff76dc25c3 (diff)
downloadtxr-405e7884dd00bfdac508d93851d898b5f7d5e4e1.tar.gz
txr-405e7884dd00bfdac508d93851d898b5f7d5e4e1.tar.bz2
txr-405e7884dd00bfdac508d93851d898b5f7d5e4e1.zip
* mpi-patches/add-mp-hash (mp_hash): Fix incorrect
code on platforms where mp_digit is smaller than long. This was left shifting a mp_digit by MP_DIGIT_BIT. It was found by compiling on NetBSD with a gcc 4.1.3 which has a broken__int128_t, forcing us to use 32 bit mp_digit with a 64 bit mp_word.
Diffstat (limited to 'mpi-patches/add-mp-hash')
-rw-r--r--mpi-patches/add-mp-hash12
1 files changed, 6 insertions, 6 deletions
diff --git a/mpi-patches/add-mp-hash b/mpi-patches/add-mp-hash
index 63b137e9..bd5e9bfa 100644
--- a/mpi-patches/add-mp-hash
+++ b/mpi-patches/add-mp-hash
@@ -1,7 +1,7 @@
Index: mpi-1.8.6/mpi.c
===================================================================
---- mpi-1.8.6.orig/mpi.c 2012-03-04 08:51:51.607484757 -0800
-+++ mpi-1.8.6/mpi.c 2012-03-04 11:49:32.456841257 -0800
+--- mpi-1.8.6.orig/mpi.c 2012-04-05 16:26:22.206340007 -0700
++++ mpi-1.8.6/mpi.c 2012-04-09 08:59:09.673643507 -0700
@@ -1960,6 +1960,34 @@
/* }}} */
@@ -13,8 +13,8 @@ Index: mpi-1.8.6/mpi.c
+ int ix;
+
+ if (USED(a) >= 2 * SIZEOF_LONG / MP_DIGIT_SIZE) {
-+ mp_digit omega = 0;
-+ mp_digit alpha = 0;
++ unsigned long omega = 0;
++ unsigned long alpha = 0;
+ for (ix = 0; ix < SIZEOF_LONG / MP_DIGIT_SIZE; ix++)
+ omega = (omega << MP_DIGIT_BIT) | DIGIT(a, ix);
+ for (ix = USED(a) - SIZEOF_LONG / MP_DIGIT_SIZE; ix < USED(a); ix++)
@@ -39,8 +39,8 @@ Index: mpi-1.8.6/mpi.c
Index: mpi-1.8.6/mpi.h
===================================================================
---- mpi-1.8.6.orig/mpi.h 2012-03-04 08:51:51.607484757 -0800
-+++ mpi-1.8.6/mpi.h 2012-03-04 11:49:32.196695007 -0800
+--- mpi-1.8.6.orig/mpi.h 2012-04-05 16:26:22.206340007 -0700
++++ mpi-1.8.6/mpi.h 2012-04-09 08:58:17.100087507 -0700
@@ -165,6 +165,8 @@
int mp_isodd(mp_int *a);
int mp_iseven(mp_int *a);