[fpc-pascal] Re: Endian issues when porting FPC programs from x86 to other platforms
bo.berglund at gmail.com
Tue Nov 2 12:41:55 CET 2010
On Tue, 02 Nov 2010 09:09:05 +0100, Bo Berglund
<bo.berglund at gmail.com> wrote:
OK, I see that there are functions to convert a known BE or LE integer
value to the *native* order. This would in principle work across all
platforms where FPC is implemented so that is good news!
However now I have the semantics to deal with because of the way
people talk about big-endian and little-endian makes me think they are
opposite to my thinking...
So let me make a short example:
Assume a 4-byte integer value consisting of the B1, B2, B3 and B3
bytes where B1 is the MSB byte and B3 is the LSB byte.
They are arranged in memory at increasing addresses as:
B1 B2 B3 B4
Now comparing to how one writes a number 1234, this would look the
same i.e. the MSB comes first and the LSB last.
The end to me is the last (the right-most) byte. And that is the LSB.
So the end is LSB, the little part...
Therefore I would imagine that this is a LITTLE endian storage but is
it really what is the common definition?
And what happens when the memory itself holds 32 bits (or more) in
each address? Then everything is stuffed into the same single address
and the above example will fail...
More information about the fpc-pascal