Re: Endianness and comparing IP's
From: drscholl <hidden>
Date: 2001-01-06 22:39:24
On Sat, Jan 06, 2001 at 10:28:48PM +0000, Iain Sandoe wrote:
quoted
All of the ints in question are unsigned, so there isn't an issue of conversion (I beleive gcc -W -Wall -pedantic would have warned if you tried to do a comparison of different types, anyway).probably (but it wouldn't be difficult to check that anyway).
Yes, I did verify that they are all unsigned int, not just relying on that. :-)
What is the code for the BSWAP32 macro? ...and what asm does it produce? (or does it use __asm() statements?)
/* 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)
(or are you convinced it is OK?)
Seems to work fine under Solaris, otherwise nobody would be able to download anything because the IP address would be reversed. ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/