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. ;)

> 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
      present  : boolean;
      rw       : boolean;
      user     : boolean;
      accessed : boolean;
      dirty    : boolean;
      unused   : Unsigned_7;
      frame    : Unsigned_20;
   end;

I guess, portability is of no concern with such a structure. ;)



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

Reply via email to