This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: warning: right shift count >= width of type
- From: Paul Schlie <schlie at comcast dot net>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 29 Nov 2004 21:58:39 -0500
- Subject: Re: warning: right shift count >= width of type
> Andreas wrote;
>> Paul Schlie <schlie@comcast.net> writes:
>> ...
>> It likely needs to define what (x << z) means if:
>>
>> - z lesser-or-equal-to 0, [i.e. does (x << -1) == (x >> 1) ?]
>
> Since left and right shift are usually separate insns this would result
> in a runtime penalty.
Sorry if I wasn't clear, the statement was made within the context of
what would likely be necessary if (x * <pow2>) == (x << (log2 <pow2>), etc.
equivalence was generally assumed to algebraically simplify expressions.
As:
((x * <pow2a>) / <pow2b>) => (x << (- <pow2a> <pow2b))
would be valid if the above and previously cited were consistently defined.