[Lazarus] C Integer types

Dave Coventry dgcoventry at gmail.com
Sat Jul 7 18:44:05 CEST 2012


Can I assume that you hadn't noticed that compr_len   =
*((int32_t*)&data[24]); was a 32 bit integer?

Is there such a thing as pint32? (Google suggests that a pint is 32 half-ounces)

compr_len:=pint64(@data[24])^;

?

On 7 July 2012 19:27, Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
> Marco van de Voort schrieb:
>
>
>> This assumes data is a pbyte or pchar (char * or byte *)
>>
>> then & translates to @, and int64_t* to pint64 the first * changes to ^ at
>> the end:
>>
>>    seqence_crc:=pint64(data)^;
>
> or
>      seqence_crc:=pint64(@data[0])^;
>
>>    seqence_key:=pint64(@data[8])^;
>>    compr_crc:=pint64(@data[16])^;
>>    compr_len:=pint64(@data[24])^;
>>
>>> I'm pretty sure there is a way of doing this natively, but I can't
>>> seem to find it.
>>
>>
>> It's 1:1 translatable. Note the absence of @ and & in the first line
>> though,
>> that is on purpose. (in both fragments)
>
>
> For the curious and nonbelievers:
> Array syntax can be used in the first line, too, see above.
>
> DoDi
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list