mp_bitcnt_signed_t

Vincent Lefevre vincent at vinc17.net
Sat Aug 22 15:20:43 UTC 2015


On 2015-08-22 14:21:55 +0200, Niels Möller wrote:
> Marc Glisse <marc.glisse at inria.fr> writes:
> > For the mpz case, the answer should always be nonnegative, so we could
> > use an unsigned type if we wanted, but I guess it is better to keep
> > the current signed type, which is consistent with the mpf case.
> 
> If it's really non-negative, I think I'd prefer the unsigned
> mp_bitcnt_t. I don't think consistency with mpf (deprecated) is
> important.

Is there any reason to prefer an unsigned type? They are really ugly
when doing arithmetic on them, as they can convert other types to
unsigned types, which can make bugs difficult to track, in particular
because this depends on the ABI. This is the reason why mpfr_prec_t
has been changed to a signed type in MPFR.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-devel mailing list