[PATCH 1/6] make byte swapping macros less opaque to the optimizer

Keith Packard keithp at keithp.com
Thu Apr 28 15:09:40 PDT 2011


On Thu, 28 Apr 2011 23:36:12 +0300, Siarhei Siamashka <siarhei.siamashka at gmail.com> wrote:

> > -#define swapl(x, n) { \
> > -                n = ((char *) (x))[0];\
> > -                ((char *) (x))[0] = ((char *) (x))[3];\
> > -                ((char *) (x))[3] = n;\
> > -                n = ((char *) (x))[1];\
> > -                ((char *) (x))[1] = ((char *) (x))[2];\
> > -                ((char *) (x))[2] = n; }

Alternatively, use an inline function with suitable types for the
arguments.

-- 
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/20110428/43965f55/attachment.pgp>


More information about the xorg-devel mailing list