xref: /original-bsd/games/battlestar/misc.c (revision 0842ddeb)
1 /*
2  * Copyright (c) 1983, 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[] = "@(#)misc.c	8.2 (Berkeley) 04/28/95";
10 #endif /* not lint */
11 
12 #include "extern.h"
13 
14 card(array, size)		/* for beenthere, injuries */
15 	register char *array;
16 	int size;
17 {
18 	register char *end = array + size;
19 	register int i = 0;
20 
21 	while (array < end)
22 		if (*array++)
23 			i++;
24 	return (i);
25 }
26 
27 ucard(array)
28 	register unsigned *array;
29 {
30 	register int j = 0, n;
31 
32 	for (n = 0; n < NUMOFOBJECTS; n++)
33 		if (testbit(array, n))
34 			    j++;
35 	return (j);
36 }
37