Basecases of mulmod_bnm1.c and sqrmod_bnm1.c

Niels Möller nisse at lysator.liu.se
Tue Sep 3 16:49:25 CEST 2013


Torbjorn Granlund <tg at gmplib.org> writes:

> I'd say we should call mpn_mul_basecase and mpn_sqr_basecase instead,
> for a few cycles less overhead.

I'm always a bit scared about calling mpn_sqr_basecase, since it may
crash (rather than just run slowly) for sizes above the appropriate
threshold...

Marco writes:

> True, but the condition ((rn & 1) != 0) can hold even above the thresholds.

Good point. The mpn_mulmod_bnm1 is written to work with any sizes. Most
(or all?) callers use mpn_mulmod_bnm1_next_size, but that may still
produce a pretty large odd number times a small power of two.

As I remember it, there was little gain in going to a very deep
recursion depth here, so below the fft range we round the size up only
to a power of 8.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list