-- TODO: Optimize this for vertical faces

function BitOps.setFaceConnectivity(connectivity, face, faceBits)
	local horizontalFace = face.Y ~= 0

	for listIndex, bitmaskIndex in ipairs(BitOps.CONNECTIVITY_INDEXES_FOR_FACE[tostring(BitOps.normalizeVec3(face))]) do
		if horizontalFace then
			connectivity = bit32.replace(connectivity, bit32.extract(faceBits, 7 - (listIndex - 1)), bitmaskIndex)
		else
			connectivity = bit32.replace(connectivity, bit32.extract(faceBits, 8 - (listIndex - 1)), bitmaskIndex)
		end
	end

	return connectivity
end
