-- 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
