[fpc-pascal] How to translate this C header struct to Pascal
Graeme Geldenhuys
graemeg.lists at gmail.com
Fri Oct 23 20:15:50 CEST 2009
Hi,
The first item is 31bit and the second item is 1 bit. Does FPC support
a record structure that can define bit level sizes?
uint32_t SearchStart:31; // file offset to full text search table
uint32_t searchlen:1; // if high bit set, size of
search record size is 16-bit
If not, I guess I can continue with what I already do - read this as
a 32bit unsigned and then when I need to work with that data, split
the 32bit value into two separate variables as shown below.
var
SearchTableOffset: longint;
SearchTableRecordLengthIs16Bit: boolean;
begin
SearchTableOffset := _pHeader^.SearchStart and $7fffffff;
SearchTableRecordLengthIs16Bit := _pHeader^.SearchStart and $80000000 > 0;
Is there any better way of doing this? Does Object Pascal record
structure support bit size definitions?
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list