Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t. (v2)

2017-09-05 Thread Eric Anholt
Pekka Paalanen writes: > [ Unknown signature status ] > On Fri, 1 Sep 2017 11:55:15 -0700 > Eric Anholt wrote: > >> --- >> >> Pekka - that link didn't help, because we still need a correct >> "result" value. I don't believe that the compiler could break

Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t. (v2)

2017-09-04 Thread Pekka Paalanen
On Fri, 1 Sep 2017 11:55:15 -0700 Eric Anholt wrote: > --- > > Pekka - that link didn't help, because we still need a correct > "result" value. I don't believe that the compiler could break uint -> > int conversions with the high bit, but here's the patch I think we > would

[PATCH xserver] squash! sync: Convert from "CARD64" to int64_t. (v2)

2017-09-01 Thread Eric Anholt
--- Pekka - that link didn't help, because we still need a correct "result" value. I don't believe that the compiler could break uint -> int conversions with the high bit, but here's the patch I think we would need for that. I still think v1 is the better version. include/misc.h | 21

Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.

2017-08-25 Thread Pekka Paalanen
On Thu, 24 Aug 2017 18:21:15 -0700 "Keith Packard" wrote: > Michel Dänzer writes: > > > Is assigning an unsigned value with the MSB set to a signed variable > > well-defined in C? > > I have no idea. And I just spent a few hours wading through the

Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.

2017-08-24 Thread Keith Packard
Michel Dänzer writes: > Is assigning an unsigned value with the MSB set to a signed variable > well-defined in C? I have no idea. And I just spent a few hours wading through the N1570 draft of the C standard on a related issue. In particular, this is worrying: 6.3.1.3 3

Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.

2017-08-24 Thread Michel Dänzer
On 25/08/17 03:57 AM, Eric Anholt wrote: > --- > > We pass the overflow unit tests both before and after this change, but > this should be safer. > > include/misc.h | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/include/misc.h b/include/misc.h > index

Re: [PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.

2017-08-24 Thread Keith Packard
Eric Anholt writes: > --- > > We pass the overflow unit tests both before and after this change, but > this should be safer. I've seen GCC do precisely the 'optimization' you are concerned about, but only when one of the operands is constant. One should use -fwrapv whenever

[PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.

2017-08-24 Thread Eric Anholt
--- We pass the overflow unit tests both before and after this change, but this should be safer. include/misc.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/misc.h b/include/misc.h index 0feeaebc7c1a..9d0e422e36b4 100644 --- a/include/misc.h +++