private void AddRunToRLE(ref RLEBitset currRLE, Run runToAdd)
{
Run currRun = new Run();
if (TryCreateUnion(currRLE.runArray.LastOrDefault(), runToAdd, ref currRun) && currRLE.runArray.Count > 0)
{
//there is overlap with the previous run in run-array so we merge this run with the previous in the array.
int tmpIndx = currRLE.runArray.Count - 1;
currRLE.runArray[tmpIndx] = currRun;
}
else
{
//no overlap with previous run in run-array, so we add the overlapping run as is.
currRLE.runArray.Add(runToAdd);
}
}