xref: /csrg-svn/old/sdb/cdefs.h (revision 7777)
1*7777Srrh /* "@(#)cdefs.h 4.2 08/17/82" */
21328Sbill /* type modifiers */
31328Sbill 
41328Sbill # define PTR  020
51328Sbill # define FTN  040
61328Sbill # define ARY  060
71328Sbill 
81328Sbill /* type packing constants */
91328Sbill 
101328Sbill # define TMASK 060
111328Sbill # define TMASK1 0300
121328Sbill # define TMASK2  0360
131328Sbill # define BTMASK 017
141328Sbill # define BTSHIFT 4
151328Sbill # define TSHIFT 2
161328Sbill 
171328Sbill /*	macros	*/
181328Sbill 
191328Sbill # define BTYPE(x)  (x&BTMASK)   /* basic type of x */
201328Sbill # define ISUNSIGNED(x) ((x)<=ULONG&&(x)>=UCHAR)
211328Sbill # define UNSIGNABLE(x) ((x)<=LONG&&(x)>=CHAR)
221328Sbill # define ENUNSIGN(x) ((x)+(UNSIGNED-INT))
231328Sbill # define DEUNSIGN(x) ((x)+(INT-UNSIGNED))
241328Sbill # define ISPTR(x) ((x&TMASK)==PTR)
251328Sbill # define ISFTN(x)  ((x&TMASK)==FTN)  /* is x a function type */
261328Sbill # define ISARY(x)   ((x&TMASK)==ARY)   /* is x an array type */
271328Sbill # define INCREF(x) (((x&~BTMASK)<<TSHIFT)|PTR|(x&BTMASK))
281328Sbill # define DECREF(x) (((x>>TSHIFT)&~BTMASK&0x3fff)|(x&BTMASK))
291328Sbill 	/* pack and unpack field descriptors (size and offset) */
301328Sbill # define PKFIELD(s,o) ((o<<6)|s)
311328Sbill # define UPKFSZ(v)  (v&077)
321328Sbill # define UPKFOFF(v) (v>>6)
331328Sbill 
34