Small limb-size in mini-gmp?

Marco Bodrato bodrato at
Sun Nov 10 11:02:07 UTC 2019

Ciao Niels!

Il 2019-11-10 09:43 nisse at ha scritto:
> I noticed the recent change
>, "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" 
and you proposed a possible syntax in

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 

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,
> should be equivalent, and slightly more readable, imo.

I agree! Adopted.


More information about the gmp-devel mailing list