summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-04-22 19:54:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-04-22 19:54:50 -0700
commit108b04b802df81d8166500dee3aa586b8575d40f (patch)
tree507e8351d00f08a9b198b45bc5a389fd8656a942 /mpi
parent269ba9af7f0ffa9dc06b90ad590cda0671822bac (diff)
downloadtxr-108b04b802df81d8166500dee3aa586b8575d40f.tar.gz
txr-108b04b802df81d8166500dee3aa586b8575d40f.tar.bz2
txr-108b04b802df81d8166500dee3aa586b8575d40f.zip
shrink-mpi-int patch
* mpi/mpi.h (mp_int): Depending on the relative size of int and pointers, turn the sign and alloc fields into bitfields, so that the structure is three words wide and therefore fits into a TXR obj_t heap object.
Diffstat (limited to 'mpi')
-rw-r--r--mpi/mpi.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/mpi/mpi.h b/mpi/mpi.h
index e4a6cec2..ba255419 100644
--- a/mpi/mpi.h
+++ b/mpi/mpi.h
@@ -72,8 +72,13 @@
#define MAX_RADIX 64
typedef struct {
+#if SIZEOF_INT >= SIZEOF_PTR
+ unsigned int sign : 1;
+ unsigned int alloc : sizeof(int)*CHAR_BIT - 1;
+#else
mp_sign sign; /* sign of this quantity */
mp_size alloc; /* how many digits allocated */
+#endif
mp_size used; /* how many digits used */
mp_digit *dp; /* the digits themselves */
} mp_int;