You can use bitpacked records: http://www.google.com/codesearch?hl=en&lr=&q=bitpacked+record+package%3Ahttp%3A%2F%2Fpasxlibbind \.googlecode\.com&sbtn=Search
Here is an example on how I use it :) Ido http://ik.homelinux.org/ On Fri, Oct 23, 2009 at 8:15 PM, Graeme Geldenhuys <graemeg.li...@gmail.com>wrote: > 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/ > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal