[fpc-devel] sub byte arrays

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jul 20 10:51:27 CEST 2010


On 20 Jul 2010, at 00:32, theo wrote:

> Is there any support from the compiler to create arrays of, say
> 
> type ttest=(one,two,three,four);
> 
> Afair, these states could be represented with 2 bits. 00,01,10,11
> 
> So four of these items could be represented in a byte (in an array of
> ttest).

Declare the array as "bitpacked":

type
  ttestarray = bitpacked array[0..3] of ttest;

Note that dynamic arrays cannot be bitpacked.


Jonas



More information about the fpc-devel mailing list