Rick Mann wrote:
All my life I've worked on big-endian machines (just about). Certainly all my C career.

In C, do I write hex constants for use on a little-endian machine as big-endian or little?

For example, if I want to mask off the high 4 bits of a 16-bit integer, would I write this:

uint_16 foo;

foo & 0x0FFF;

or would I write:

foo & 0xFF0F;

It is: foo & 0x0FFF

it is the same as foo & 4095. If endian mattered, you'd have to change every
number in your program to compile it on a different endian machine.


_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to