On 13 Aug 2008, at 11:59, Vinzent Höfler wrote:

leledumbo wrote:
Since no one answers on message board, I'll post it here.
C struct:
typedef unsigned int u32int;
typedef struct page
{
 u32int present    : 1;   // Page present in memory
 u32int rw         : 1;   // Read-only if clear, readwrite if set
 u32int user       : 1;   // Supervisor level only if clear
 u32int accessed   : 1;   // Has the page been accessed since last
refresh?
 u32int dirty      : 1;   // Has the page been written to since last
refresh?
 u32int unused     : 7;   // Amalgamation of unused and reserved bits
 u32int frame      : 20;  // Frame address (shifted right 12 bits)
} page_t;

Hmm. That's nasty. ;)w

> Pascal record please...

Should be something like that:

type
 Unsigned_7  = 0 .. (1 shl 7)  - 1;
 Unsigned_20 = 0 .. (1 shl 20) - 1;

type
 page_t = bitpacked record

Yes and no: the layout of bitpacked records is by no means guaranteed to be the same as that of a C record, regardless of the definition of the C record. The internal format of bitpacked records is opaque and must not be used in any case where data has to be interchanged or where a particular layout is desired.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to