xref: /csrg-svn/usr.bin/pascal/libpc/INCT.c (revision 3008)
11659Smckusick /* Copyright (c) 1979 Regents of the University of California */
21659Smckusick 
3*3008Smckusic static char sccsid[] = "@(#)INCT.c 1.2 03/07/81";
41659Smckusick 
51659Smckusick #include "h00vars.h"
61659Smckusick 
7*3008Smckusic bool
81659Smckusick INCT(element, paircnt, singcnt, data)
91659Smckusick 
10*3008Smckusic 	register long	element;	/* element to find */
11*3008Smckusic 	long		paircnt;	/* number of pairs to check */
12*3008Smckusic 	long		singcnt;	/* number of singles to check */
13*3008Smckusic 	long		data;		/* paircnt plus singcnt bounds */
141659Smckusick {
15*3008Smckusic 	register long	*dataptr = &data;
161659Smckusick 	register int	cnt;
171659Smckusick 
181659Smckusick 	for (cnt = 0; cnt < paircnt; cnt++) {
191659Smckusick 		if (element > *dataptr++) {
201659Smckusick 			dataptr++;
211659Smckusick 			continue;
221659Smckusick 		}
231659Smckusick 		if (element >= *dataptr++) {
241659Smckusick 			return TRUE;
251659Smckusick 		}
261659Smckusick 	}
271659Smckusick 	for (cnt = 0; cnt < singcnt; cnt++) {
281659Smckusick 		if (element == *dataptr++) {
291659Smckusick 			return TRUE;
301659Smckusick 		}
311659Smckusick 	}
321659Smckusick 	return FALSE;
331659Smckusick }
34