gmp-impl.h assumes 32-bit unsigned int in fft_table_nk

Marco Bodrato bodrato at mail.dm.unipi.it
Mon Dec 21 06:55:24 UTC 2015


Ciao,

Il Sab, 19 Dicembre 2015 5:09 am, Robert Baruch ha scritto:
> Oh, BTW, there is also the same problem in mpn/trialdiv.c:68, where
> gmp_primes_tab has a 24-bit field in an unsigned int.

Uhm...

unsigned int idx:24;	/* index of  first primes in dtab */

Makefile asks gen-trialdivtab to generate tables up-to 8000. There are
1007 primes smaller than 8000, so that the index should fit in 10 bits...

unsigned int np :8;	/* number of primes related to this entry */

The product of the smallest 31 primes requires more than 160 bits, much
larger than any limb size we currently support... np should fit in 5
bits...

With tighter definitions, both bit fields should fit a 16-bit integer.

Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-bugs mailing list