Small limb-size in mini-gmp?
Marco Bodrato
bodrato at mail.dm.unipi.it
Sat Nov 16 15:42:04 UTC 2019
Il 2019-11-13 22:20 nisse at lysator.liu.se ha scritto:
> tg at gmplib.org (Torbjörn Granlund) writes:
>
>> 2. follow Marco's proposal allowing "char", "short", "int", "long",
>> and
>> perhaps the spacey "long long" as overriding types, or
>
> I guess that's good enough for now. But is it that difficult to do
> quoting of "unsigned char"? Something like
>
> make check-mini-gmp CPPFLAGS='-D"MINI_GMP_LIMB_TYPE=unsigned char"'
With the patch below applied, the following line works on shell:
gmake CPPFLAGS='-DMINI_GMP_LIMB_TYPE=unsigned\ char' check-mini-gmp
And also on my Debian...
diff -r 0a7bccdcda14 Makefile.am
--- a/Makefile.am Sat Nov 16 08:48:59 2019 +0100
+++ b/Makefile.am Sat Nov 16 11:52:46 2019 +0100
@@ -442,7 +442,7 @@
MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \
LDFLAGS="-L../../.libs" \
LIBS="-lgmp -lm" \
- CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="-I../.." check
+ CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)
-I../.." check
clean-mini-gmp:
if [ -d mini-gmp/tests ] ; then \
diff -r 0a7bccdcda14 mini-gmp/mini-gmp.h
--- a/mini-gmp/mini-gmp.h Sat Nov 16 08:48:59 2019 +0100
+++ b/mini-gmp/mini-gmp.h Sat Nov 16 11:52:46 2019 +0100
@@ -53,7 +53,11 @@
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t));
-typedef unsigned long mp_limb_t;
+#ifndef MINI_GMP_LIMB_TYPE
+#define MINI_GMP_LIMB_TYPE unsigned long
+#endif
+
+typedef MINI_GMP_LIMB_TYPE mp_limb_t;
typedef long mp_size_t;
typedef unsigned long mp_bitcnt_t;
Ĝis,
m
--
http://bodrato.it/papers/
More information about the gmp-devel
mailing list