Forgot about middle-endian?
September 07, 2011 at 03:11 AM
Sometimes I mix the meaning of little endian and big endian. I got confuse which one is which. But remembering this illustration would really help.
September 07, 2011 at 03:29 AM
The nose is the most significant, the tail the least significant part? I guess the pig would agree, the butcher definitely wouldn't.
September 07, 2011 at 08:45 AM
September 07, 2011 at 09:48 AM
Don't get it! What is the point?
I would expect the little-endian pig to head right. Some more information, please :)
Michael Menzel |
September 07, 2011 at 11:54 AM
I don't get it.
big-endian store values left to right and little-endian right to left.
Your little-endian looks like a middle-endian :-)
September 07, 2011 at 12:16 PM
Actually, big-endian and little endian doens't have a shift.
One would be the reflection of the other.
So the second picture should be the pig looking to the other side.
September 07, 2011 at 03:15 PM
September 07, 2011 at 05:16 PM
Nice 16-bit sample of little/big endian. Could you also provie 32-bit and 64-bit samples, i.e. 4 slices or 8 slices of that pig?
September 07, 2011 at 10:17 PM
This is the reason why the only valid way to encode unicode is UTF8.
September 08, 2011 at 08:07 AM
Haha, okay, so which end is most significant on a pig?
September 08, 2011 at 05:39 PM
Ulrich Tewes |
September 09, 2011 at 08:36 PM
And it's still wrong: '(1 << (index % (8 * sizeof(*ptr)))) & ptr[index / (8 * sizeof (*ptr))]' only addresses the same bit independent of whether ptr ist char, short, int or long when it is a little-endian machine.
What is actually wrong, and why hex dumps look good on big-endian machines is that we order bits within the byte differently than we order bytes in the usual hex dump. The poor big endian pig only looks good because we chopped it up twice. :-)
September 10, 2011 at 10:00 AM
This is actually the best depiction of "pig-endianness" that I have ever seen! :-)
(And it's totally precise as well.)
September 11, 2011 at 05:21 PM
There seems to be some confusion in the comments (eg. should it be a left-to-right facing pig).
The image is correct. It conveys the important fact that this is about BYTE order, not BIT order.
It should also not be confused with serial communications.
September 21, 2011 at 05:43 PM
The comments to this entry are closed.
I'm a IT-guy in Hamburg, Germany