Micro-GMP
Marco Bodrato
bodrato at mail.dm.unipi.it
Tue Dec 11 02:55:53 UTC 2018
Ciao,
Il Lun, 10 Dicembre 2018 10:07 pm, Niels Möller ha scritto:
> I recommend adding -p to the diff flags.
Ok, I attach it again, with -p, and slightly improved.
> First, how would this be configured? Adding an
>
> #ifndef GMP_LIMB_BITS
>
> around the mp_limb_t typedef in mini-gmp.h, and around the related
> defines in mini-gmp.c? Then one could do
>
> #define GMP_LIMB_BITS 8
> typedef uint8_t mp_limb_t;
> #include "mini-gmp.c"
Sounds like a good idea.
> One could aim to support any GMP_LIMB_BITS between, say, 3 and the size
> of unsigned long long. For unusual sizes one would need to combine with
> asl.h or something similar.
Supporting very small sizes, and odd sizes might not be easy. And
currently Paul reported failures for 32-bit limbs on 64-bit machines...
asl.h is more interesting for GMP than for mini-.
> And we obviously need test coverage for it.
Well, that's not difficult, we just need some configuration hack as the
one you proposed, and a check-mini-gmp-8 target.
> BTW, please use parentheses in expressions like
> assert ((r0 & GMP_LIMB_MAX >> GMP_LIMB_BITS - shift) == 0);
I pushed
assert ((r0 & GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift)) == 0);
> And I think we should always require that arithmetic on mp_limb_t is mod
> (GMP_LIMB_MAX + 1), so that & GMP_LIMB_MAX usually is redundant (with
Do you mean I should have pushed the line with even more parentheses?
assert ((r0 & (GMP_LIMB_MAX >> (GMP_LIMB_BITS - shift))) == 0);
Ĝis,
m
--
http://bodrato.it/papers/
More information about the gmp-devel
mailing list