Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
1489a805
Commit
1489a805
authored
3 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
250974f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
44 deletions
+44
-44
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+22
-22
wcfs/internal/xbtree/blib/zrangemap_void.go
wcfs/internal/xbtree/blib/zrangemap_void.go
+22
-22
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
1489a805
...
...
@@ -144,44 +144,44 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
//
entries
in
[
ilo
:
jhi
)
∈
[
r
.
Lo
,
r
.
hi
)
and
should
be
merged
into
one
//
XXX
check
different
values
if
(
jhi
-
ilo
)
>
1
{
lo
:=
S
.
range
v
[
ilo
].
Lo
hi_
:=
S
.
range
v
[
jhi
-
1
].
Hi_
vReplaceSlice
(&
S
.
range
v
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
debugfRMap
(
"
\t
merge
S[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
S
)
lo
:=
M
.
entry
v
[
ilo
].
Lo
hi_
:=
M
.
entry
v
[
jhi
-
1
].
Hi_
vReplaceSlice
(&
M
.
entry
v
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
debugfRMap
(
"
\t
merge
M[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
M
)
}
jhi
=
-
1
//
no
longer
valid
//
if
[
r
.
lo
,
r
.
hi
)
was
outside
of
any
entry
-
create
new
entry
if
r
.
Hi_
<
S
.
range
v
[
ilo
].
Lo
{
vInsert
(&
S
.
range
v
,
ilo
,
r
)
debugfRMap
(
"
\t
insert %s
\t
-> %s
\n
"
,
r
,
S
)
if
r
.
Hi_
<
M
.
entry
v
[
ilo
].
Lo
{
vInsert
(&
M
.
entry
v
,
ilo
,
r
)
debugfRMap
(
"
\t
insert %s
\t
-> %s
\n
"
,
r
,
M
)
}
//
now
we
have
covered
entries
merged
as
needed
into
[
ilo
]
//
extend
this
entry
if
r
coverage
is
wider
if
r
.
Lo
<
S
.
range
v
[
ilo
].
Lo
{
S
.
range
v
[
ilo
].
Lo
=
r
.
Lo
debugfRMap
(
"
\t
extend left
\t
-> %s
\n
"
,
S
)
if
r
.
Lo
<
M
.
entry
v
[
ilo
].
Lo
{
M
.
entry
v
[
ilo
].
Lo
=
r
.
Lo
debugfRMap
(
"
\t
extend left
\t
-> %s
\n
"
,
M
)
}
if
r
.
Hi_
>
S
.
range
v
[
ilo
].
Hi_
{
S
.
range
v
[
ilo
].
Hi_
=
r
.
Hi_
debugfRMap
(
"
\t
extend right
\t
-> %s
\n
"
,
S
)
if
r
.
Hi_
>
M
.
entry
v
[
ilo
].
Hi_
{
M
.
entry
v
[
ilo
].
Hi_
=
r
.
Hi_
debugfRMap
(
"
\t
extend right
\t
-> %s
\n
"
,
M
)
}
//
and
check
if
we
should
merge
it
with
right
/
left
neighbours
if
ilo
+
1
<
len
(
S
.
range
v
)
{
//
right
if
S
.
rangev
[
ilo
].
Hi_
+
1
==
S
.
range
v
[
ilo
+
1
].
Lo
{
//
XXX
&&
.
value
same
vReplaceSlice
(&
S
.
range
v
,
ilo
,
ilo
+
2
,
KeyRange
{
S
.
rangev
[
ilo
].
Lo
,
S
.
range
v
[
ilo
+
1
].
Hi_
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
S
)
if
ilo
+
1
<
len
(
M
.
entry
v
)
{
//
right
if
M
.
entryv
[
ilo
].
Hi_
+
1
==
M
.
entry
v
[
ilo
+
1
].
Lo
{
//
XXX
&&
.
value
same
vReplaceSlice
(&
M
.
entry
v
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
].
Lo
,
M
.
entry
v
[
ilo
+
1
].
Hi_
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
if
ilo
>
0
{
//
left
if
S
.
rangev
[
ilo
-
1
].
Hi_
+
1
==
S
.
range
v
[
ilo
].
Lo
{
//
XXX
&&
.
value
same
vReplaceSlice
(&
S
.
range
v
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
S
.
rangev
[
ilo
-
1
].
Lo
,
S
.
range
v
[
ilo
].
Hi_
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
S
)
if
M
.
entryv
[
ilo
-
1
].
Hi_
+
1
==
M
.
entry
v
[
ilo
].
Lo
{
//
XXX
&&
.
value
same
vReplaceSlice
(&
M
.
entry
v
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
].
Lo
,
M
.
entry
v
[
ilo
].
Hi_
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
This diff is collapsed.
Click to expand it.
wcfs/internal/xbtree/blib/zrangemap_void.go
View file @
1489a805
...
...
@@ -146,44 +146,44 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
// entries in [ilo:jhi) ∈ [r.Lo,r.hi) and should be merged into one
// XXX check different values
if
(
jhi
-
ilo
)
>
1
{
lo
:=
S
.
range
v
[
ilo
]
.
Lo
hi_
:=
S
.
range
v
[
jhi
-
1
]
.
Hi_
vReplaceSlice__RangedMap_void
(
&
S
.
range
v
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
debugf_RangedMap_void
(
"
\t
merge
S[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
S
)
lo
:=
M
.
entry
v
[
ilo
]
.
Lo
hi_
:=
M
.
entry
v
[
jhi
-
1
]
.
Hi_
vReplaceSlice__RangedMap_void
(
&
M
.
entry
v
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
debugf_RangedMap_void
(
"
\t
merge
M[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
M
)
}
jhi
=
-
1
// no longer valid
// if [r.lo,r.hi) was outside of any entry - create new entry
if
r
.
Hi_
<
S
.
range
v
[
ilo
]
.
Lo
{
vInsert__RangedMap_void
(
&
S
.
range
v
,
ilo
,
r
)
debugf_RangedMap_void
(
"
\t
insert %s
\t
-> %s
\n
"
,
r
,
S
)
if
r
.
Hi_
<
M
.
entry
v
[
ilo
]
.
Lo
{
vInsert__RangedMap_void
(
&
M
.
entry
v
,
ilo
,
r
)
debugf_RangedMap_void
(
"
\t
insert %s
\t
-> %s
\n
"
,
r
,
M
)
}
// now we have covered entries merged as needed into [ilo]
// extend this entry if r coverage is wider
if
r
.
Lo
<
S
.
range
v
[
ilo
]
.
Lo
{
S
.
range
v
[
ilo
]
.
Lo
=
r
.
Lo
debugf_RangedMap_void
(
"
\t
extend left
\t
-> %s
\n
"
,
S
)
if
r
.
Lo
<
M
.
entry
v
[
ilo
]
.
Lo
{
M
.
entry
v
[
ilo
]
.
Lo
=
r
.
Lo
debugf_RangedMap_void
(
"
\t
extend left
\t
-> %s
\n
"
,
M
)
}
if
r
.
Hi_
>
S
.
range
v
[
ilo
]
.
Hi_
{
S
.
range
v
[
ilo
]
.
Hi_
=
r
.
Hi_
debugf_RangedMap_void
(
"
\t
extend right
\t
-> %s
\n
"
,
S
)
if
r
.
Hi_
>
M
.
entry
v
[
ilo
]
.
Hi_
{
M
.
entry
v
[
ilo
]
.
Hi_
=
r
.
Hi_
debugf_RangedMap_void
(
"
\t
extend right
\t
-> %s
\n
"
,
M
)
}
// and check if we should merge it with right/left neighbours
if
ilo
+
1
<
len
(
S
.
range
v
)
{
// right
if
S
.
rangev
[
ilo
]
.
Hi_
+
1
==
S
.
range
v
[
ilo
+
1
]
.
Lo
{
// XXX && .value same
vReplaceSlice__RangedMap_void
(
&
S
.
range
v
,
ilo
,
ilo
+
2
,
KeyRange
{
S
.
rangev
[
ilo
]
.
Lo
,
S
.
range
v
[
ilo
+
1
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
S
)
if
ilo
+
1
<
len
(
M
.
entry
v
)
{
// right
if
M
.
entryv
[
ilo
]
.
Hi_
+
1
==
M
.
entry
v
[
ilo
+
1
]
.
Lo
{
// XXX && .value same
vReplaceSlice__RangedMap_void
(
&
M
.
entry
v
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entry
v
[
ilo
+
1
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
if
ilo
>
0
{
// left
if
S
.
rangev
[
ilo
-
1
]
.
Hi_
+
1
==
S
.
range
v
[
ilo
]
.
Lo
{
// XXX && .value same
vReplaceSlice__RangedMap_void
(
&
S
.
range
v
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
S
.
rangev
[
ilo
-
1
]
.
Lo
,
S
.
range
v
[
ilo
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
S
)
if
M
.
entryv
[
ilo
-
1
]
.
Hi_
+
1
==
M
.
entry
v
[
ilo
]
.
Lo
{
// XXX && .value same
vReplaceSlice__RangedMap_void
(
&
M
.
entry
v
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entry
v
[
ilo
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment