[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Unsigned Integer Encoding
From:       Wojciech Puchar <wojtek () wojtek ! tensor ! gdynia ! pl>
Date:       2012-08-15 13:34:44
Message-ID: alpine.BSF.2.00.1208151532450.58257 () wojtek ! tensor ! gdynia ! pl
[Download RAW message or body]

> /* This prints 04030201 */
> printf ("b= %0X \n", *b);
>
all is OK, you did this probably on x86 CPU which is little endian. on 
powerpc it would be 01020304 as it is big endian.

to write endian independent code:

man htonl

all these are macros actually.

"network order" is big endian. so eg htonl would reverse order on x86, and 
ddo nothing on powerpc.


_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic