function BitOps.setFaceConnectivity(z,y,H)local d=y.Y~=0 for y,m in ipairs(BitOps.CONNECTIVITY_INDEXES_FOR_FACE[tostring(BitOps.normalizeVec3(y))])do if d then z=bit32.replace(z,bit32.extract(H,7-(y-1)),m)else z=bit32.replace(z,bit32.extract(H,8-(y-1)),m)end end return z end

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
