-- Return the number of common items that precede in reverse direction.
-- The length of what Myers paper calls a “snake” in a reverse path.

local function countCommonItemsR(
	aStart: number,
	aIndex: number,
	bStart: number,
	bIndex: number,
	isCommon: IsCommon
): number
	local nCommon = 0
	while aStart <= aIndex and bStart <= bIndex and isCommon(aIndex, bIndex) do
		aIndex = aIndex - 1
		bIndex = bIndex - 1
		nCommon = nCommon + 1
	end
	return nCommon
end
