[fpc-pascal] Function to set high and low Dword of a QWord

Florian Klaempfl florian at freepascal.org
Wed Feb 28 18:06:36 CET 2007


Jonas Maebe schrieb:
> 
> On 28 feb 2007, at 17:51, Luiz Americo Pereira Camara wrote:
> 
>>  I'm looking to a function that will take two DWord as arguments and
>> and returns a Qword where the low 4 bytes are the first DWord and the
>> High 4 bytes the second DWord.
> 
> function makeqword(d1, d2: dword): qword;
> begin
>   result:=(qword(d2) shl 32) or d1;
> end;

Cleaner imo:

lo(result):=d1;
hi(result):=d2;

> 
>>  TQWordRec = record
>>    D1: Dword;
>>    D2: DWord;
>>  end;
>>
>> TQWordRec will have the same memory representation of  the result of
>> such function?
> 
> Only on little endian, on big endian it's the other way round.
> 
> 
> Jonas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list