xref: /original-bsd/usr.bin/pascal/libpc/INCT.c (revision 957a0273)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)INCT.c 1.2 03/07/81";
4 
5 #include "h00vars.h"
6 
7 bool
8 INCT(element, paircnt, singcnt, data)
9 
10 	register long	element;	/* element to find */
11 	long		paircnt;	/* number of pairs to check */
12 	long		singcnt;	/* number of singles to check */
13 	long		data;		/* paircnt plus singcnt bounds */
14 {
15 	register long	*dataptr = &data;
16 	register int	cnt;
17 
18 	for (cnt = 0; cnt < paircnt; cnt++) {
19 		if (element > *dataptr++) {
20 			dataptr++;
21 			continue;
22 		}
23 		if (element >= *dataptr++) {
24 			return TRUE;
25 		}
26 	}
27 	for (cnt = 0; cnt < singcnt; cnt++) {
28 		if (element == *dataptr++) {
29 			return TRUE;
30 		}
31 	}
32 	return FALSE;
33 }
34