Commit 7ae1abd4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a5b9b19b
......@@ -323,13 +323,13 @@ func (M *RangedMap) delRange(r KeyRange) (i int) {
}
if M.entryv[ilo].Lo < r.Lo { // shrink left
M.entryv[ilo].Hi_ = r.Lo-1
ilo++
debugfRMap("\tshrink [%d] left \t-> %s\n", ilo, M)
ilo++
}
if r.Hi_ < M.entryv[jhi-1].Hi_ { // shrink right
M.entryv[jhi-1].Lo = r.Hi_+1
jhi--
debugfRMap("\tshrink [%d] right\t-> %s\n", jhi-1, M)
jhi--
}
if (jhi - ilo) > 0 {
......
......@@ -113,6 +113,18 @@ func TestRangedMap(t *testing.T) {
n), // Has
// - shrink left/right (value !same) + new entry
E(
M(1,4,a), // A
K(2,6,x), // B
M(1,2,a, 2,6,x), // Set
M(1,2,a), // Del
n), // Has
E(
M(5,8,b), // A
K(2,6,x), // B
M(2,6,x, 6,8,b), // Set
M( 6,8,b), // Del
n), // Has
E(
M(1,4,a, 5,8,b), // A
K(2,6,x), // B
......
......@@ -325,13 +325,13 @@ func (M *_RangedMap_str) delRange(r KeyRange) (i int) {
}
if M.entryv[ilo].Lo < r.Lo { // shrink left
M.entryv[ilo].Hi_ = r.Lo-1
ilo++
debugf_RangedMap_str("\tshrink [%d] left \t-> %s\n", ilo, M)
ilo++
}
if r.Hi_ < M.entryv[jhi-1].Hi_ { // shrink right
M.entryv[jhi-1].Lo = r.Hi_+1
jhi--
debugf_RangedMap_str("\tshrink [%d] right\t-> %s\n", jhi-1, M)
jhi--
}
if (jhi - ilo) > 0 {
......
......@@ -325,13 +325,13 @@ func (M *_RangedMap_void) delRange(r KeyRange) (i int) {
}
if M.entryv[ilo].Lo < r.Lo { // shrink left
M.entryv[ilo].Hi_ = r.Lo-1
ilo++
debugf_RangedMap_void("\tshrink [%d] left \t-> %s\n", ilo, M)
ilo++
}
if r.Hi_ < M.entryv[jhi-1].Hi_ { // shrink right
M.entryv[jhi-1].Lo = r.Hi_+1
jhi--
debugf_RangedMap_void("\tshrink [%d] right\t-> %s\n", jhi-1, M)
jhi--
}
if (jhi - ilo) > 0 {
......
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