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

Matt Turner mattst88 at gmail.com
Wed Apr 27 22:11:17 PDT 2011


On Thu, Apr 28, 2011 at 12:44 AM, Keith Packard <keithp at keithp.com> wrote:
> On Wed, 27 Apr 2011 19:33:01 -0400, Matt Turner <mattst88 at gmail.com> wrote:
>> The follow-up patch to this which removes the temporary variables used
>> by the swap macros is too big for the mailing list, so please review it
>> here:
>> http://cgit.freedesktop.org/~mattst88/xserver/commit/?id=11ff6813cf2f2a04243f4eecb60078d77fc973ec
>
> Did you use some automatic tool for this conversion? If so, it would be
> nice to see what you used.

I used Coccinelle and a simple semantic patch to remove the second
argument from swap[ls]:
---
@@
expression x, n;
@@

- swapl(x, n)
+ swapl(x)

@@
expression x, n;
@@

- swaps(x, n)
+ swaps(x)
---

Removing the unused variables was a lot of grep and then vim regex. I
wish I knew a better way.

Matt


More information about the xorg-devel mailing list