[Lazarus] reading a little endian long.

Marc Weustink marc at dommelstein.net
Mon Dec 22 01:11:38 CET 2008


Dave Coventry wrote:
> Wow.
> 
> If I can push a little more: Can I read in an eight-byte IEEE double
> using the same trick?

The example below is not complete, you need to cast.

MyDouble:=LEtoN(PDouble(@buffer[5])^);

Use codejumping (find declaration) on LEtoN to see what variants exist.

Marc

> 
> 2008/12/21 Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com>:
>> On Sun, Dec 21, 2008 at 6:26 AM, Dave Coventry <dgcoventry at gmail.com> wrote:
>>> Is there any documentation on this?
>> http://www.freepascal.org/docs-html/rtl/system/index-5.html
>>
>>> would the following:
>>>
>>> longv:=LEtoN(@buffer[5]);
>>>
>>> be the same as:
>> No, it's better. It only performs a conversion from Little Endian to
>> current encoding. So it will just copy the contents if your software
>> is running in a little endian processor or do the adequate conversion
>> if your software is running in a big endian processor.
>>
>> --
>> Felipe Monteiro de Carvalho
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> 




More information about the Lazarus mailing list