add Berkeley specific header
[unix-history] / usr / src / games / battlestar / misc.c
CommitLineData
fdc7d56f 1/*
e95fc82a
KB
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
fdc7d56f
EW
11 */
12
4d5dca4b 13#ifndef lint
e95fc82a
KB
14static char sccsid[] = "@(#)misc.c 5.1 (Berkeley) %G%";
15#endif /* not lint */
4d5dca4b
EW
16
17#include "externs.h"
18
19card(array, size) /* for beenthere, injuries */
20 register char *array;
21 int size;
22{
23 register char *end = array + size;
24 register int i = 0;
25
26 while (array < end)
27 if (*array++)
28 i++;
29 return (i);
30}
31
32ucard(array)
33 register unsigned *array;
34{
35 register int j = 0, n;
36
37 for (n = 0; n < NUMOFOBJECTS; n++)
38 if (testbit(array, n))
39 j++;
40 return (j);
41}