xref: /csrg-svn/usr.bin/pascal/libpc/IN.c (revision 62092)
140865Sbostic /*-
2*62092Sbostic  * Copyright (c) 1979, 1993
3*62092Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71658Smckusick 
840865Sbostic #ifndef lint
9*62092Sbostic static char sccsid[] = "@(#)IN.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111658Smckusick 
121658Smckusick #include "h00vars.h"
131658Smckusick 
143007Smckusic bool
IN(element,lower,upper,setptr)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