Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Bo Berglund
On Mon, 19 Oct 2015 15:32:00 +0200, Jonas Maebe wrote: > >Bo Berglund wrote on Mon, 19 Oct 2015: > >> Is there a function or such to interrogate the byte order of the >> platform FPC runs on? So that I could add a test at the start of >> download to check if swapping is needed? > >Use the http://

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Sven Barth
Am 19.10.2015 16:23 schrieb "Bo Berglund" : > > On Mon, 19 Oct 2015 15:30:36 +0200 (CEST), Michael Van Canneyt > wrote: > > >There are compiler defines that give you the endianness. > >{$IFDEF ENDIAN_BIG} > >{$IFDEF ENDIAN_LITTLE} > > > >And > >{$IFDEF FPC_LITTLE_ENDIAN} > >{$IFDEF FPC_BIG_ENDIAN}

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Bo Berglund
On Mon, 19 Oct 2015 15:30:36 +0200 (CEST), Michael Van Canneyt wrote: >There are compiler defines that give you the endianness. >{$IFDEF ENDIAN_BIG} >{$IFDEF ENDIAN_LITTLE} > >And >{$IFDEF FPC_LITTLE_ENDIAN} >{$IFDEF FPC_BIG_ENDIAN} Good, that would probably be what I need. Thanks! Example: pro

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 19 Oct 2015, Jonas Maebe wrote: > Bo Berglund wrote on Mon, 19 Oct 2015: > > > Is there a function or such to interrogate the byte order of the > > platform FPC runs on? So that I could add a test at the start of > > download to check if swapping is needed? > > Use the http://www.free

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 19 Oct 2015, Bo Berglund wrote: > I am making a control program for a data collection system using FPC + > Lazarus on a Raspberry Pi2 platform. I will use a number of Delphi > units, which implement the communications and data handling needs in a > way that works fine on a Windows pla

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Jonas Maebe
Bo Berglund wrote on Mon, 19 Oct 2015: Is there a function or such to interrogate the byte order of the platform FPC runs on? So that I could add a test at the start of download to check if swapping is needed? Use the http://www.freepascal.org/docs-html/rtl/system/ntobe.html function and yo

Re: [fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Michael Van Canneyt
On Mon, 19 Oct 2015, Bo Berglund wrote: I am making a control program for a data collection system using FPC + Lazarus on a Raspberry Pi2 platform. I will use a number of Delphi units, which implement the communications and data handling needs in a way that works fine on a Windows platform. W

[fpc-pascal] Byte order modification in fpc on ARM?

2015-10-19 Thread Bo Berglund
I am making a control program for a data collection system using FPC + Lazarus on a Raspberry Pi2 platform. I will use a number of Delphi units, which implement the communications and data handling needs in a way that works fine on a Windows platform. While looking over existing code I see that th

Re: [fpc-pascal]byte order

2003-07-04 Thread Peter Vreman
>> > If not, how can I determine the current processor byte order? >> >> {$ifdef FPC_BIG_ENDIAN} >> {$ifdef FPC_LITTLE_ENDIAN} > > Thanks. Oops... this was 1.1 only. For 1.0.x (and still supported by 1.1, but deprecated) it is ENDIAN_LITTLE and ENDIAN_BIG ___

Re: [fpc-pascal]byte order

2003-07-04 Thread Mattias Gaertner
On Fri, 4 Jul 2003 11:42:59 +0200 (CEST) "Peter Vreman" <[EMAIL PROTECTED]> 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

Re: [fpc-pascal]byte order

2003-07-04 Thread Matt Emson
The word you are looking for is 'Big Endian'. Have a google on 'Big Endian' and 'Little Endian' on google. this is a delphi routine, it may not work in FPC, certainly I would try it first in Delphi compatibility mode, and with Intel style assembler syntax: function Swap32(value : dword) : dword

Re: [fpc-pascal]byte order

2003-07-04 Thread Peter Vreman
> 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/q

[fpc-pascal]byte order

2003-07-04 Thread Mattias Gaertner
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 independen