function BitOps.setFaceConnectivity(y,k,S)local x=k.Y~=0 for k,T in ipairs(BitOps.CONNECTIVITY_INDEXES_FOR_FACE[tostring(BitOps.normalizeVec3(k))])do if x then y=bit32.replace(y,bit32.extract(S,7-(k-1)),T)else y=bit32.replace(y,bit32.extract(S,8-(k-1)),T)end end return y end
-- 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
