Commit | Line | Data |
---|---|---|
6941fcc4 | 1 | /* |
c5749c79 KB |
2 | * Copyright (c) 1988 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
65b2d9b4 | 5 | * %sccs.include.redist.c% |
c5749c79 | 6 | * |
a0f5c935 | 7 | * @(#)useful.h 6.1 (Berkeley) %G% |
c5749c79 | 8 | */ |
6941fcc4 | 9 | |
6e36536d | 10 | # include <sys/types.h> |
1146de6b EA |
11 | |
12 | /* support for bool type */ | |
13 | typedef char bool; | |
6941fcc4 EA |
14 | # define TRUE 1 |
15 | # define FALSE 0 | |
16 | ||
17 | # ifndef NULL | |
18 | # define NULL 0 | |
f3d8f6d6 | 19 | # endif /* NULL */ |
21d76258 | 20 | |
1146de6b | 21 | /* bit hacking */ |
9e7b5f61 | 22 | # define bitset(bit, word) (((word) & (bit)) != 0) |
29871fef | 23 | |
04308aae EA |
24 | /* some simple functions */ |
25 | # ifndef max | |
26 | # define max(a, b) ((a) > (b) ? (a) : (b)) | |
27 | # define min(a, b) ((a) < (b) ? (a) : (b)) | |
28 | # endif max | |
29 | ||
4e5e456f EA |
30 | /* assertions */ |
31 | # ifndef NASSERT | |
32 | # define ASSERT(expr, msg, parm)\ | |
33 | if (!(expr))\ | |
34 | {\ | |
35 | fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ | |
36 | fprintf(stderr, msg, parm);\ | |
37 | } | |
f3d8f6d6 | 38 | # else /* NASSERT */ |
4e5e456f | 39 | # define ASSERT(expr, msg, parm) |
f3d8f6d6 | 40 | # endif /* NASSERT */ |
4e5e456f EA |
41 | |
42 | /* sccs id's */ | |
43 | # ifndef lint | |
44 | # define SCCSID(arg) static char SccsId[] = "arg"; | |
f3d8f6d6 | 45 | # else /* lint */ |
4e5e456f EA |
46 | # define SCCSID(arg) |
47 | # endif lint |