xref: /csrg-svn/old/sdb/cdefs.h (revision 1328)
1*1328Sbill /* "@(#)cdefs.h 4.1 10/09/80" */
2*1328Sbill /* type modifiers */
3*1328Sbill 
4*1328Sbill # define PTR  020
5*1328Sbill # define FTN  040
6*1328Sbill # define ARY  060
7*1328Sbill 
8*1328Sbill /* type packing constants */
9*1328Sbill 
10*1328Sbill # define TMASK 060
11*1328Sbill # define TMASK1 0300
12*1328Sbill # define TMASK2  0360
13*1328Sbill # define BTMASK 017
14*1328Sbill # define BTSHIFT 4
15*1328Sbill # define TSHIFT 2
16*1328Sbill 
17*1328Sbill /*	macros	*/
18*1328Sbill 
19*1328Sbill # define BTYPE(x)  (x&BTMASK)   /* basic type of x */
20*1328Sbill # define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR)
21*1328Sbill # define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR)
22*1328Sbill # define ENUNSIGN(x) ((x)+(UNSIGNED-INT))
23*1328Sbill # define DEUNSIGN(x) ((x)+(INT-UNSIGNED))
24*1328Sbill # define ISPTR(x) ((x&TMASK)==PTR)
25*1328Sbill # define ISFTN(x)  ((x&TMASK)==FTN)  /* is x a function type */
26*1328Sbill # define ISARY(x)   ((x&TMASK)==ARY)   /* is x an array type */
27*1328Sbill # define INCREF(x) (((x&~BTMASK)<<TSHIFT)|PTR|(x&BTMASK))
28*1328Sbill # define DECREF(x) (((x>>TSHIFT)&~BTMASK&0x3fff)|(x&BTMASK))
29*1328Sbill 	/* pack and unpack field descriptors (size and offset) */
30*1328Sbill # define PKFIELD(s,o) ((o<<6)|s)
31*1328Sbill # define UPKFSZ(v)  (v&077)
32*1328Sbill # define UPKFOFF(v) (v>>6)
33*1328Sbill 
34