Date: Tue, 03 Jun 1997 10:29:21 -0700 From: Bill Currie Subject: Re: big endian class To: Andrew Crabtree Cc: djgpp AT delorie DOT com Reply-to: billc AT blackmagic DOT tait DOT co DOT nz Message-id: <33945471.6B4A@blackmagic.tait.co.nz> Organization: Tait Electronics NZ MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit References: <199706021721 DOT AA028672063 AT typhoon DOT rose DOT hp DOT com> Precedence: bulk Andrew Crabtree wrote: > Even thats more than necessary. From Intels action code for > bswap > > dst = (rotate_left(src 8) & 0x00FF00FF) > + (rotate_left(src 24) & 0xFF00FF00) Hmm, I wander what that will optimise to on a 386. Thanks for the code, it looks good (and I would never have though of it). > Of course, you need a bitwise rotate operator, which C doesn't have. > Inline asm should work though. Not quite true, gcc will optimise (x<<8)|(x>>24) to (assuming eax is used for x) roll $8,%eax. Bill -- Leave others their otherness.