xref: /original-bsd/usr.bin/pascal/libpc/IN.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1979, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)IN.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "h00vars.h"
13 
14 bool
15 IN(element, lower, upper, setptr)
16 
17 	long	element;	/* element to check */
18 	long	lower;		/* lowest element of set */
19 	long	upper;		/* upper - lower of set */
20 	char	setptr[];	/* pointer to set */
21 {
22 	register int	indx;
23 
24 	if ((indx = element - lower) < 0 || indx > upper)
25 		return FALSE;
26 	if (setptr[indx >> LG2BITSBYTE] & (1 << (indx & MSKBITSBYTE)))
27 		return TRUE;
28 	return FALSE;
29 }
30