[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Endianness macros capitalization

From: Pavel Roskin
Subject: Re: Endianness macros capitalization
Date: Wed, 09 Jul 2008 02:47:27 -0400

On Tue, 2008-07-08 at 20:04 +0200, Christian Franke wrote:

> With old gcc versions without the "rol" optimization, even the 16 bit 
> swap should be a function:

Or better yet, an asm statement.

We should consider optimized assembly vs function call.  Even the 32-bit
swap could be shorter:

   a:   86 c4                   xchg   %al,%ah
   c:   c1 c0 10                rol    $0x10,%eax
   f:   86 c4                   xchg   %al,%ah

That's 7 bytes!  And if written properly, it could work with any of the
registers that allow access to the lower two bytes (%eax, %ebx, %ecx and
%edx), thus giving more flexibility to the optimizer.

Pavel Roskin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]