Endianness and comparing IP's
Iain Sandoe
iain at sandoe.co.uk
Sun Jan 7 10:37:24 EST 2001
> /* 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...
Iain.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list