Commit 0e9a86f0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 97edfd89
......@@ -82,17 +82,17 @@ func (S *RangeSet) AddRange(r Range) {
lo := S.rangev[ilo].lo
hi_ := S.rangev[jhi-1].hi_
S.rangev = append(
S.rangev[:ilo],
Range{lo, hi_},
S.rangev[jhi:]...)
S.rangev[:ilo], append([]Range{
Range{lo, hi_}},
S.rangev[jhi:]...)...)
}
// if [r.lo,r.hi) was outside of any entry - create new entry
if r.hi_ <= S.rangev[ilo].lo {
S.rangev = append(
S.rangev[:ilo],
r,
S.rangev[ilo:])
S.rangev[:ilo], append([]Range{
r},
S.rangev[ilo:]...)...)
}
// now we have covered entries merged as needed into [ilo]
......@@ -108,9 +108,9 @@ func (S *RangeSet) AddRange(r Range) {
if ilo < len(S.rangev) {
if S.rangev[ilo].hi_ == S.rangev[ilo+1].lo {
S.rangev = append(
S.rangev[:ilo],
Range{S.rangev[ilo].lo, S.rangev[ilo+1].hi_},
S.rangev[ilo+2:]...)
S.rangev[:ilo], append([]Range{
Range{S.rangev[ilo].lo, S.rangev[ilo+1].hi_}},
S.rangev[ilo+2:]...)...)
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment