Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-16 Thread Giuliano Colla
Il 16/04/2012 01:44, Andrew Haines ha scritto: There exists the BEtoN and LEtoN functions you can use. (NtoLE and NtoBE also) Thanks to everybody. Now I believe to have enough information to proceed. I'll keep this little piece of discussion as an example to show when someone asks me why I pr

Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-16 Thread Mark Morgan Lloyd
Jonas Maebe wrote: On 16 Apr 2012, at 00:38, Giuliano Colla wrote: I'm dealing with a large number of data coming from an external device. They are big-endian 16 bits signed numbers, which must be converted to integer and to real to perform calculations. Besides the obvious solutions of treat

Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-15 Thread Andrew Haines
On 04/15/12 18:38, Giuliano Colla wrote: > I'm dealing with a large number of data coming from an external device. > They are big-endian 16 bits signed numbers, which must be converted to > integer and to real to perform calculations. > > Besides the obvious solutions of treating them as isolated

Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-15 Thread Giuliano Colla
Il 16/04/2012 00:42, Jonas Maebe ha scritto: On 16 Apr 2012, at 00:38, Giuliano Colla wrote: I'm dealing with a large number of data coming from an external device. They are big-endian 16 bits signed numbers, which must be converted to integer and to real to perform calculations. Besides the

Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-15 Thread Jonas Maebe
On 16 Apr 2012, at 00:38, Giuliano Colla wrote: > I'm dealing with a large number of data coming from an external device. > They are big-endian 16 bits signed numbers, which must be converted to > integer and to real to perform calculations. > > Besides the obvious solutions of treating them as

Re: [fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-15 Thread Jeppe Græsdal Johansen
Just use the BEtoN function. That will convert whatever big-endian number to your native endian. I don't know what speed it has, but it sure is elegant :) Den 16-04-2012 00:38, Giuliano Colla skrev: I'm dealing with a large number of data coming from an external device. They are big-endian 16

[fpc-pascal] Converting big-endian signed 16bits values to fpc integer

2012-04-15 Thread Giuliano Colla
I'm dealing with a large number of data coming from an external device. They are big-endian 16 bits signed numbers, which must be converted to integer and to real to perform calculations. Besides the obvious solutions of treating them as isolated bytes, multipying by 256 the highest, adding th