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

Keith Packard keithp at keithp.com
Sun Mar 6 13:36:22 PST 2011


On Sun,  6 Mar 2011 20:39:46 +0100, Cyril Brulebois <kibi at 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:

        0xffffffff and 0x00000000

        (int) (0xffffffff - 0x00000000) <= 0    TRUE

        0xffffffff <= 0x00000000                FALSE

We want the former result, not the latter.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110306/0fef8b3e/attachment.pgp>


More information about the xorg-devel mailing list