Sync usage with man page.
[netbsd-mini2440.git] / dist / ipf / lib / count6bits.c
blob9faee6dbfbd51ed5abdeb2a578ab410b08108879
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2000-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: count6bits.c,v 1.4.4.1 2006/06/16 17:20:57 darrenr Exp
9 */
11 #include "ipf.h"
14 int count6bits(msk)
15 u_32_t *msk;
17 int i = 0, k;
18 u_32_t j;
20 for (k = 3; k >= 0; k--)
21 if (msk[k] == 0xffffffff)
22 i += 32;
23 else {
24 for (j = msk[k]; j; j <<= 1)
25 if (j & 0x80000000)
26 i++;
28 return i;