Skip to contentSkip to conversation

Endianness and comparing IP's

DISCUSSION Iain Sandoe 1 participant 1 message Jan 6, 2001

lore
Share & tools
lore
#0 lore raw

Sat, Jan 6, 2001, drscholl wrote...
[...]

Quoted 3 lines
Quoted 1 line

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. :-)

hmmm. I suppose that the literals in the macro are int by definition?

Quoted 6 lines

/* 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)

Quoted 1 line

(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.

works OK for me too under linuxppc (with default compiler options - got anything weird specified?).

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