This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Changes to the wide-int classes
- From: Mike Stump <mikestump at comcast dot net>
- To: rdsandiford at googlemail dot com
- Cc: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, rguenther at suse dot de, Kenneth Zadeck <zadeck at naturalbridge dot com>
- Date: Sun, 1 Sep 2013 22:30:07 -0700
- Subject: Re: [RFC] Changes to the wide-int classes
- Authentication-results: sourceware.org; auth=none
- References: <87wqn0bb5q dot fsf at talisman dot default> <5223F9D7 dot 1030307 at naturalbridge dot com>
On Sep 1, 2013, at 7:37 PM, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
> On 09/01/2013 03:21 PM, Richard Sandiford wrote:
>>
>> * As Richard requested, the main wide int class is parameterised by the
>> storage:
>>
>> template <typename storage>
>> class GTY(()) generic_wide_int : public storage
Careful of GTY, it gets finicky around the corners. I suspect you already tested this and it works...
>> Hmm, if we decide to forbid the use of "and" in gcc,
Why would we do that?
>> * A static assert also prevents fixed_wide_ints from being initialised
>> from wide_ints. I think combinations like that would always be a
>> mistake.
I don't see why. In C, this:
int i;
long l = i;
is not an error, and while a user might not want to do this, other times, it is completely reasonable.
>> I've deliberately not tackled any of the other things that have been
>> talked about, such as whether excess bits should be defined, whether
>> the blocks should be HWIs, etc. I've also kept things like
>> "wi::one (prec)", although this is now exactly equivalent to
>> "wi::shwi (1, prec)". I'm not sure either way on whether the
>> one() form is worth keeping.
wi::one(prec) is 3 words, wi::shwi (1, prec) is 4. Not a big point.