Marco Bodrato <bodr...@mail.dm.unipi.it> writes:

>   limb = (unsigned int) sp[sn] >> (bits - shift);

That's easier to read than what I proposed.

> Maybe the cast is unnecessary, because the C standard says that the
> left operand of a shift operation is always promoted to (unsigned) int
> if it is smaller, correct?

I think so, but it's a bit subtle, so I'd prefer the explicit cast.
Maybe worth a comment mentioning the problem case: mp_limb_t
== unsigned char, bits == 8, shift == 0

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to