[PATCH libX11 1/2] xcb_io: Fix Xlib 32-bit request number wrapping

Mouse mouse at Rodents-Montreal.ORG
Sun Nov 17 11:20:05 PST 2013


>    *wide = new + ((unsigned long) (new < *wide) << 16 << 16);

> The comment says "Treating the comparison as a 1 and shifting it
> avoids a conditional branch".

Only on architectures with conditional moves - and, on those, the
version using ? : is likely to compile down to a conditional move
anyway.  I think that comment should be fixed.

> I guess the sizeof comparison would not be necessary since the
> condition should never meet with 64-bit longs.

Unless it's in a code fragment that's used only on machines with
<64-bit longs, it will; X runs on systems with 64-bit longs.

> And if it does, something is wrong anyway (from my understanding).
> After all this is the trigger of the bug.

Does anyone know whether the bug triggers on systems with 64-bit longs?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse at rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


More information about the xorg-devel mailing list