1 /* $FreeBSD$ */ 2 3 /* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * $Id$ 9 */ 10 11 #include "ipf.h" 12 13 14 int 15 count6bits(u_32_t *msk) 16 { 17 int i = 0, k; 18 u_32_t j; 19 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++; 27 } 28 return (i); 29 } 30