xref: /original-bsd/games/battlestar/misc.c (revision 149041bc)
1 /*
2  * Copyright (c) 1983 Regents of the University of California,
3  * All rights reserved.  Redistribution permitted subject to
4  * the terms of the Berkeley Software License Agreement.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)misc.c	1.2 04/24/85";
9 #endif
10 
11 #include "externs.h"
12 
13 card(array, size)		/* for beenthere, injuries */
14 	register char *array;
15 	int size;
16 {
17 	register char *end = array + size;
18 	register int i = 0;
19 
20 	while (array < end)
21 		if (*array++)
22 			i++;
23 	return (i);
24 }
25 
26 ucard(array)
27 	register unsigned *array;
28 {
29 	register int j = 0, n;
30 
31 	for (n = 0; n < NUMOFOBJECTS; n++)
32 		if (testbit(array, n))
33 			    j++;
34 	return (j);
35 }
36