From: Andrew Crabtree Message-Id: <199706021721.AA028672063@typhoon.rose.hp.com> Subject: Re: big endian class To: keithh AT zetnet DOT co DOT uk (Keith Hull) Date: Mon, 02 Jun 1997 10:21:02 PDT Cc: djgpp AT delorie DOT com In-Reply-To: <1997060116282677565@zetnet.co.uk>; from "Keith Hull" at Jun 1, 97 4:28 pm Precedence: bulk > or > > dummy = (data & 0x000000ff) << 24; > dummy = dummy | ((data & 0x0000ff00) << 8); > dummy = dummy | ((data & 0x00FF0000) >> 8); > dummy = dummy | ((data & 0xFF000000) >> 24); Even thats more than necessary. From Intels action code for bswap dst = (rotate_left(src 8) & 0x00FF00FF) + (rotate_left(src 24) & 0xFF00FF00) Of course, you need a bitwise rotate operator, which C doesn't have. Inline asm should work though. Andrew