<div dir="ltr">You can use bitpacked records:<br><br><a href="http://www.google.com/codesearch?hl=en&lr=&q=bitpacked+record+package%3Ahttp%3A%2F%2Fpasxlibbind">http://www.google.com/codesearch?hl=en&lr=&q=bitpacked+record+package%3Ahttp%3A%2F%2Fpasxlibbind</a>\.googlecode\.com&sbtn=Search<br>
<br>Here is an example on how I use it :)<br><br>Ido<br clear="all"><a href="http://ik.homelinux.org/">http://ik.homelinux.org/</a><br>
<br><br><div class="gmail_quote">On Fri, Oct 23, 2009 at 8:15 PM, Graeme Geldenhuys <span dir="ltr"><<a href="mailto:graemeg.lists@gmail.com">graemeg.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
The first item is 31bit and the second item is 1 bit. Does FPC support<br>
a record structure that can define bit level sizes?<br>
<br>
<br>
uint32_t SearchStart:31; // file offset to full text search table<br>
uint32_t searchlen:1; // if high bit set, size of<br>
search record size is 16-bit<br>
<br>
If not, I guess I can continue with what I already do - read this as<br>
a 32bit unsigned and then when I need to work with that data, split<br>
the 32bit value into two separate variables as shown below.<br>
<br>
var<br>
SearchTableOffset: longint;<br>
SearchTableRecordLengthIs16Bit: boolean;<br>
begin<br>
SearchTableOffset := _pHeader^.SearchStart and $7fffffff;<br>
SearchTableRecordLengthIs16Bit := _pHeader^.SearchStart and $80000000 > 0;<br>
<br>
<br>
Is there any better way of doing this? Does Object Pascal record<br>
structure support bit size definitions?<br>
<br>
<br>
--<br>
Regards,<br>
- Graeme -<br>
<br>
<br>
_______________________________________________<br>
fpGUI - a cross-platform Free Pascal GUI toolkit<br>
<a href="http://opensoft.homeip.net/fpgui/" target="_blank">http://opensoft.homeip.net/fpgui/</a><br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div><br></div>