Mail Archives: djgpp/1997/06/02/18:33:04
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.
- Raw text -