Skip to content
Snippets Groups Projects
Commit b42b10f6 authored by David Sehnal's avatar David Sehnal
Browse files

ordered set

parent a80c3a34
No related branches found
No related tags found
No related merge requests found
......@@ -428,7 +428,8 @@ function substractRR(a: Range, b: Range) {
if (isRangeSubset(a, b)) {
// this splits the interval into two, gotta represent it as a set.
const l = _sRB.fst - _sRA.fst, r = _sRA.snd - _sRB.snd;
// TODO: check if l === 0 || r === 0 ==> result would be a range
if (l <= 0) return OrderedSet.ofRange(_sRB.snd + 1, _sRB.snd + r);
if (r <= 0) return OrderedSet.ofRange(_sRA.fst, _sRA.fst + l - 1);
const ret = new Int32Array(l + r);
let offset = 0;
for (let i = 0; i < l; i++) ret[offset++] = _sRA.fst + i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment