|
Boost : |
From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2006-05-26 09:14:53
Le vendredi 26 mai 2006 à 14:08 +0200, Maarten Kronenburg a écrit :
> As a response for a request for sub
> integers, in the document I will delete the
> is_even and is_odd member functions,
> and add:
> const integer highest_bit() const;
> const integer lowest_bit() const;
In my opinion, is_odd and is_even have a clearer meaning. When I read
lowest_bit and highest_bit, a lot of questions come to my mind:
Are they implementation-defined? Or are they the lowest and highest bits
in a sign-magnitude representation of integers? Or is it a 2's
complement representation? Or maybe a 1's complement representation? Is
the highest bit of a positive integer always 1? Or will its value depend
on the machine word size and the integer size? Do these functions really
have to return an integer?
> const integer get_sub( const integer &, const integer & ) const;
> By the way here no size_type is used, because
> size_type suffices for the range of bytes,
> but not for the range of bits, which is a factor
> 8 larger.
Same kind of question here: this member extracts a sub-integer with
respect to which representation? For example, what does a sub-integer of
a negative integer look like?
Also I wouldn't worry too much about size_type being too short by a
factor 8 :-). Somebody who really needs to use integers that long will
probably use its own hand-crafted classes in order to be sure a library
will not do any memory allocation to store them.
Sorry if all these questions were already answered in your draft and I
failed to find it.
Best regards,
Guillaume
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk