add UNLEASHED_OBJ to unleashed.mk
[unleashed/tickless.git] / usr / src / cmd / ipf / lib / common / count6bits.c
blobe9a5159366000518738528912d610c7b831088fa
1 /*
2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: count6bits.c,v 1.4 2001/06/09 17:09:23 darrenr Exp $
7 */
9 #include "ipf.h"
12 int count6bits(msk)
13 u_32_t *msk;
15 int i = 0, k;
16 u_32_t j;
18 for (k = 3; k >= 0; k--)
19 if (msk[k] == 0xffffffff)
20 i += 32;
21 else {
22 for (j = msk[k]; j; j <<= 1)
23 if (j & 0x80000000)
24 i++;
26 return i;