[fpc-pascal]byte order

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jul 3 19:37:36 CEST 2003


Hi,

I need to read 2, 4 or 8 bytes in a processor independent way. For example:
I have 4 bytes ($12 $34 $56 $78), starting with the most signifikant (like
the 68k processor). Reading a DWord under i386 swaps the bytes ($78563412).
Is there a fast way/procedure to read a word/dword/qword independent of the
processor?
Something like 

function GetWordInLeastSignifikantByteOrder(P: PWord): Word;

If not, how can I determine the current processor byte order?


Mattias




More information about the fpc-pascal mailing list