[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

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

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 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 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