warning: right shift count >= width of type
Paul Schlie
schlie@comcast.net
Tue Nov 30 04:23:00 GMT 2004
> 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.
More information about the Gcc
mailing list