function BitOps.numOfSetBits(N)local f=0 while N~=0 do N=bit32.band(N,N-1)f=f+1 end return f end return BitOps
-- Implementation of Brian Kernighan's algorithm
function BitOps.numOfSetBits(int)
	local count = 0
	while int ~= 0 do
		int = bit32.band(int, int - 1)
		count = count + 1
	end

	return count
end

return BitOps
