[PATCH xquartz 04/10] randr: Silence -Wshift-negative-value warnings
Jeremy Huddleston Sequoia
jeremyhu at apple.com
Wed Oct 14 15:44:44 PDT 2015
> On Oct 14, 2015, at 15:33, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:
> On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:
>> rrtransform.c:199:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value,Semantic Issue]
>> rot_cos = F(-1);
>> - rot_cos = F(-1);
>> + rot_cos = F(~0u);
> Is -1 guaranteed to be ~0u on all platforms? Or just all the ones we know
> and care about?
I'm pretty certain that ~0u and -1 are the same bit patterns on all platforms. I can't think of a reason why they wouldn't be.
> Would it be better to instead do:
> -#define F(x) IntToxFixed(x)
> +#define F(x) IntToxFixed((uint32_t) x)
> in randr/rrtransform.c ?
> -Alan Coopersmith- alan.coopersmith at oracle.com
> Oracle Solaris Engineering - http://blogs.oracle.com/alanc
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4109 bytes
Desc: not available
More information about the xorg-devel