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