Re: [PATCH 1/2] os: Fix buggy integer comparison.

2011-03-07 Thread Cyril Brulebois
Keith Packard kei...@keithp.com (06/03/2011): […] We want the former result, not the latter. Unless being pointed to the appropriate stuff from 2002 by Alan (thanks!), what we want isn't exactly clear while going through the code. Might deserve some comments, maybe? That was already reported

Re: [PATCH 1/2] os: Fix buggy integer comparison.

2011-03-07 Thread Keith Packard
On Mon, 7 Mar 2011 14:32:20 +0100, Cyril Brulebois k...@debian.org wrote: Might deserve some comments, maybe? I suppose; I guess it never seemed obscure to me (or at least, hasn't for years) Shall we proceed with tweaking that assert()? A quick testing shows that both my 1.7 and 1.10 servers

[PATCH 1/2] os: Fix buggy integer comparison.

2011-03-06 Thread Cyril Brulebois
(CARD32 can be unsigned int or unsigned long, but the following applies to both, it's only a matter of signedness.) Trying to compare two unsigned integers by diffing them and then casting that into a signed quantity is wrong in one half of all cases (i.e.: the difference is higher than maximal

Re: [PATCH 1/2] os: Fix buggy integer comparison.

2011-03-06 Thread Alan Coopersmith
On 03/ 6/11 11:39 AM, Cyril Brulebois wrote: - while (timers (int) (timers-expires - now) = 0) + while (timers (timers-expires = now)) That's restoring the original X11R6 code and undoing the bugfixes from X11R6.6/XFree86 days to handle GetTimeInMillis wraparound.

Re: [PATCH 1/2] os: Fix buggy integer comparison.

2011-03-06 Thread Keith Packard
On Sun, 6 Mar 2011 20:39:46 +0100, Cyril Brulebois k...@debian.org wrote: Accordingly, replace all: (int) (foo-bar) = 0 tests with: foo = bar For testing time values, the original code is what we want. Consider: 0x and 0x (int) (0x -