xref: /original-bsd/usr.bin/pascal/libpc/INCT.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[] = "@(#)INCT.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "h00vars.h"
13 
14 bool
15 INCT(element, paircnt, singcnt, data)
16 
17 	register long	element;	/* element to find */
18 	long		paircnt;	/* number of pairs to check */
19 	long		singcnt;	/* number of singles to check */
20 	long		data;		/* paircnt plus singcnt bounds */
21 {
22 	register long	*dataptr = &data;
23 	register int	cnt;
24 
25 	for (cnt = 0; cnt < paircnt; cnt++) {
26 		if (element > *dataptr++) {
27 			dataptr++;
28 			continue;
29 		}
30 		if (element >= *dataptr++) {
31 			return TRUE;
32 		}
33 	}
34 	for (cnt = 0; cnt < singcnt; cnt++) {
35 		if (element == *dataptr++) {
36 			return TRUE;
37 		}
38 	}
39 	return FALSE;
40 }
41