|
|
1.1 root 1: /*
2: * static char ID_def4h[] = "@(#) define4.h: 1.1 1/7/82";
3: */
4:
5: /*
6: * macros for manipulation
7: *
8: *
9: *
10: * BUILDPN build itemid from page number and address space
11: * number
12: * BYTEMASK mask the size of an itemid's byte-offset
13: * MAXSP maximum number of address spaces:
14: * 2**SPIDBITS
15: * PAGEMASK mask the size of an itemid's page-offset
16: * PAGESIZE size of page, in bytes:
17: * 2**BYTEBITS
18: * SPIDBITS number of bits of itemid holing the address
19: * space number
20: * SPIDMASK mask the size of an itemid's space-number
21: * SPSIZE size of address space, in pages
22: * 2**PAGEBITS
23: * XTRCTBY extract and right-justify byte offset from itemid
24: * XTRCTPN extract and right-justify page number from itemid
25: * XTRCTSP extract and right-justify address space number from
26: * itemid
27: */
28:
29: #define SPIDBITS (ITEMSIZE-PAGEBITS-BYTEBITS)
30: #define MAXSP (1 << SPIDBITS)
31: #define PAGESIZE (1 << BYTEBITS)
32: #define SPSIZE (1L << PAGEBITS)
33:
34: #define BYTEMASK (PAGESIZE - 1L)
35: #define PAGEMASK (SPSIZE - 1L)
36: #define SPIDMASK (MAXSP - 1L)
37:
38: #define BUILDPN(p,s) (((long) s) << (PAGEBITS+BYTEBITS)) | (((long) p) << BYTEBITS)
39:
40: #define XTRCTBY(i) ((int) ((i) & BYTEMASK))
41: #define XTRCTPN(i) (((i) >> BYTEBITS) & PAGEMASK)
42: #define XTRCTSP(i) ((int) (((i) >> (PAGEBITS+BYTEBITS)) & SPIDMASK))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.