Small toom43 cleanup

bodrato at bodrato at
Wed Oct 21 05:26:13 CEST 2009


> mp_size_t is a signed type, for various reasons.  size_t is an unsigned
> type.  Unsigned division by constants is a few cycles faster.

Ok, but in all cases we have

mp_size_t bn;
mp_size_t n = (bn-1) / (cast type) 3;

Does the compiler know that (bn-1) is unsigned positive? I do not think so...
Will it compile a signed or an unsigned division?
Maybe it is better to cast the other side:

mp_size_t n = ((unsigned type)bn-1) / 3;

and let the compiler decide the best type for the small constants 1 and 3 ?


More information about the gmp-devel mailing list