Unsigned Integer Encoding

2012-08-15 Thread Daniel Grech
Hi, I have what is probably a really elementary question but I can't seem to figure it out. In the following snippet of code, why is it that a and b do not have the same value in the end ? : #define uint32_t unsigned int #define uint16_t unsigned short #define uint8_t unsigned char #define

Re: Unsigned Integer Encoding

2012-08-15 Thread Václav Zeman
On 08/15/2012 10:33 AM, Daniel Grech wrote: Hi, I have what is probably a really elementary question but I can't seem to figure it out. In the following snippet of code, why is it that a and b do not have the same value in the end ? : #define uint32_t unsigned int #define uint16_t

Re: Unsigned Integer Encoding

2012-08-15 Thread Peter Jeremy
On 2012-Aug-15 10:33:46 +0200, Daniel Grech dgre...@gmail.com wrote: Hi, I have what is probably a really elementary question but I can't seem to figure it out. In the following snippet of code, why is it that a and b do not have the same value in the end ? : See

Re: Unsigned Integer Encoding

2012-08-15 Thread Wojciech Puchar
/* 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