xref: /csrg-svn/games/battlestar/misc.c (revision 34234)
118723Sedward /*
2*34234Sbostic  * Copyright (c) 1983 Regents of the University of California.
3*34234Sbostic  * All rights reserved.
4*34234Sbostic  *
5*34234Sbostic  * Redistribution and use in source and binary forms are permitted
6*34234Sbostic  * provided that this notice is preserved and that due credit is given
7*34234Sbostic  * to the University of California at Berkeley. The name of the University
8*34234Sbostic  * may not be used to endorse or promote products derived from this
9*34234Sbostic  * software without specific prior written permission. This software
10*34234Sbostic  * is provided ``as is'' without express or implied warranty.
1118723Sedward  */
1218723Sedward 
1317387Sedward #ifndef lint
14*34234Sbostic static char sccsid[] = "@(#)misc.c	5.1 (Berkeley) 05/08/88";
15*34234Sbostic #endif /* not lint */
1617387Sedward 
1717387Sedward #include "externs.h"
1817387Sedward 
1917387Sedward card(array, size)		/* for beenthere, injuries */
2017387Sedward 	register char *array;
2117387Sedward 	int size;
2217387Sedward {
2317387Sedward 	register char *end = array + size;
2417387Sedward 	register int i = 0;
2517387Sedward 
2617387Sedward 	while (array < end)
2717387Sedward 		if (*array++)
2817387Sedward 			i++;
2917387Sedward 	return (i);
3017387Sedward }
3117387Sedward 
3217387Sedward ucard(array)
3317387Sedward 	register unsigned *array;
3417387Sedward {
3517387Sedward 	register int j = 0, n;
3617387Sedward 
3717387Sedward 	for (n = 0; n < NUMOFOBJECTS; n++)
3817387Sedward 		if (testbit(array, n))
3917387Sedward 			    j++;
4017387Sedward 	return (j);
4117387Sedward }
42