xref: /csrg-svn/usr.bin/pascal/libpc/IN.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71658Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)IN.c	1.3 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111658Smckusick 
121658Smckusick #include "h00vars.h"
131658Smckusick 
143007Smckusic bool
151658Smckusick IN(element, lower, upper, setptr)
161658Smckusick 
173007Smckusic 	long	element;	/* element to check */
183007Smckusic 	long	lower;		/* lowest element of set */
193007Smckusic 	long	upper;		/* upper - lower of set */
201658Smckusick 	char	setptr[];	/* pointer to set */
211658Smckusick {
223007Smckusic 	register int	indx;
231658Smckusick 
241658Smckusick 	if ((indx = element - lower) < 0 || indx > upper)
251658Smckusick 		return FALSE;
263007Smckusic 	if (setptr[indx >> LG2BITSBYTE] & (1 << (indx & MSKBITSBYTE)))
271658Smckusick 		return TRUE;
281658Smckusick 	return FALSE;
291658Smckusick }
30