Small limb-size in mini-gmp?

Marco Bodrato bodrato at mail.dm.unipi.it
Sun Nov 10 11:02:07 UTC 2019


Ciao Niels!

Il 2019-11-10 09:43 nisse at lysator.liu.se ha scritto:
> I noticed the recent change
> https://gmplib.org/repo/gmp/rev/d5f4f8640be9, "mini-gmp: Avoid 
> undefined
> behaviour with small limb sizes."

> Are you planning to do something like artificial-small-limbs
> for mini-gmp, suggested on the list a while ago?

The current code should work smoothly if you change mini-gmp.h and
typedef unsigned char mp_limb_t;
or use others unsigned types. Hopefully, both larger and smaller than 
the default unsigned long should work.

It works thanks to the last corrections and to the work done last year 
after the discussion on Paul's micro-gmp.

Paul also asked us "to indicate in mini-gmp.h the places to modify" 
(https://gmplib.org/list-archives/gmp-devel/2018-December/005123.html) 
and you proposed a possible syntax in 
https://gmplib.org/list-archives/gmp-devel/2018-December/005126.html

But I'm not sure we should officially document this feature, for the 
simple reason that... it is not currently tested by our great testing 
framework.

So, I'm not "planning" anything more that what was already done. Except 
possibly enabling an easy way to test the code with 8, 16, 32-bits 
types... But it is not a priority for me, at the moment.

Maybe it works also for artificialy-small-limbs, maybe not. I did not 
try, and I'm not planning any other change to support them.

> Also,
> 
>   if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS)
> 
> should be equivalent, and slightly more readable, imo.

I agree! Adopted.

Ĝis,
m


More information about the gmp-devel mailing list