Date: Wed, 15 Aug 2012 15:34:44 +0200 (CEST) From: Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl> To: Daniel Grech <dgre090@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Unsigned Integer Encoding Message-ID: <alpine.BSF.2.00.1208151532450.58257@wojtek.tensor.gdynia.pl> In-Reply-To: <CAG167sY3-i_MimZGJ7qv9NC-u6e2w6RWq_fZt3amFn3%2BjdeKbQ@mail.gmail.com> References: <CAG167sY3-i_MimZGJ7qv9NC-u6e2w6RWq_fZt3amFn3%2BjdeKbQ@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
> /* 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.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1208151532450.58257>
