Thread (1 message) 1 message, 1 author, 2001-01-07

Re: Endianness and comparing IP's

From: Keith Clayton <hidden>
Date: 2001-01-07 02:54:00

Good catch!


On Sat, Jan 06, 2001 at 11:37:24PM +0000, Iain Sandoe wrote:
quoted
/* 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.
--
<><><><><><><><><><><><>
Keith Clayton
clay-ton@pacbell.net

"If you don't trust me with your source code,
            why should I trust you with my computer?"

GPG key: http://www.jps.net/kclayton/keith_public_key.html
         http://www.keyserver.net

GPG fingerprint: 0C47 F1A1 0434 588C 9457  D53F D86A 5449 43F6 09A0


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help