1164Seric /* 2*62532Sbostic * Copyright (c) 1988, 1993 3*62532Sbostic * The Regents of the University of California. All rights reserved. 433781Sbostic * 542830Sbostic * %sccs.include.redist.c% 633781Sbostic * 7*62532Sbostic * @(#)useful.h 8.1 (Berkeley) 06/07/93 833781Sbostic */ 9164Seric 1011723Seric # include <sys/types.h> 114148Seric 124148Seric /* support for bool type */ 134148Seric typedef char bool; 14164Seric # define TRUE 1 15164Seric # define FALSE 0 16164Seric 17164Seric # ifndef NULL 18164Seric # define NULL 0 1956794Seric # endif /* NULL */ 202975Seric 214148Seric /* bit hacking */ 227113Seric # define bitset(bit, word) (((word) & (bit)) != 0) 234086Seric 2410120Seric /* some simple functions */ 2510120Seric # ifndef max 2610120Seric # define max(a, b) ((a) > (b) ? (a) : (b)) 2710120Seric # define min(a, b) ((a) < (b) ? (a) : (b)) 2858889Seric # endif 2910120Seric 305196Seric /* assertions */ 315196Seric # ifndef NASSERT 325196Seric # define ASSERT(expr, msg, parm)\ 335196Seric if (!(expr))\ 345196Seric {\ 355196Seric fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ 365196Seric fprintf(stderr, msg, parm);\ 375196Seric } 3856794Seric # else /* NASSERT */ 395196Seric # define ASSERT(expr, msg, parm) 4056794Seric # endif /* NASSERT */ 415196Seric 425196Seric /* sccs id's */ 435196Seric # ifndef lint 445196Seric # define SCCSID(arg) static char SccsId[] = "arg"; 4558889Seric # else 465196Seric # define SCCSID(arg) 4758889Seric # endif 48