[fpc-pascal]byte order
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Jul 4 12:02:09 CEST 2003
On Fri, 4 Jul 2003 11:42:59 +0200 (CEST)
"Peter Vreman" <peter at freepascal.org> wrote:
> > 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?
>
> {$ifdef FPC_BIG_ENDIAN}
> {$ifdef FPC_LITTLE_ENDIAN}
Thanks.
Mattias
More information about the fpc-pascal
mailing list