Endianness and comparing IP's

Geert Uytterhoeven geert at linux-m68k.org
Mon Jan 8 18:16:05 EST 2001


On Sat, 6 Jan 2001, Iain Sandoe wrote:
> > /* convert the bytes of a 32-bit integer to little endian */
> > #define BSWAP32(c)
> > ((c>>24)&0xff)|((c>>8)&0xff00)|((c<<8)&0xff0000)|(c<<24)
>
>  #define BSWAP32(c) \
> (((c>>24)&0xff)|((c>>8)&0xff00)|((c<<8)&0xff0000)|(c<<24))
>
>
> will work as you expect it too... ;-)
>
> precedence is a funny thing...

Similarly, replace `c' by `(c)'.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list