141edb306SCy Schubert 241edb306SCy Schubert /* 341edb306SCy Schubert * Copyright (C) 2012 by Darren Reed. 441edb306SCy Schubert * 541edb306SCy Schubert * See the IPFILTER.LICENCE file for details on licencing. 641edb306SCy Schubert * 741edb306SCy Schubert * $Id$ 841edb306SCy Schubert */ 941edb306SCy Schubert 1041edb306SCy Schubert #include "ipf.h" 1141edb306SCy Schubert 1241edb306SCy Schubert 13efeb8bffSCy Schubert int count6bits(u_32_t * msk)14efeb8bffSCy Schubertcount6bits(u_32_t *msk) 1541edb306SCy Schubert { 1641edb306SCy Schubert int i = 0, k; 1741edb306SCy Schubert u_32_t j; 1841edb306SCy Schubert 1941edb306SCy Schubert for (k = 3; k >= 0; k--) 2041edb306SCy Schubert if (msk[k] == 0xffffffff) 2141edb306SCy Schubert i += 32; 2241edb306SCy Schubert else { 2341edb306SCy Schubert for (j = msk[k]; j; j <<= 1) 2441edb306SCy Schubert if (j & 0x80000000) 2541edb306SCy Schubert i++; 2641edb306SCy Schubert } 27*2582ae57SCy Schubert return (i); 2841edb306SCy Schubert } 29