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
485f8c21
Commit
485f8c21
authored
Sep 27, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1489a805
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+6
-6
wcfs/internal/xbtree/blib/rangeset.go
wcfs/internal/xbtree/blib/rangeset.go
+2
-2
wcfs/internal/xbtree/blib/zrangemap_void.go
wcfs/internal/xbtree/blib/zrangemap_void.go
+6
-6
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
485f8c21
...
...
@@ -99,7 +99,7 @@ func (M *RangedMap) Get_(k Key) (v VALUE, ok bool) {
}
//
found
return
e
.
v
alue
,
true
return
e
.
V
alue
,
true
}
//
SetRange
changes
M
to
map
key
range
r
to
value
v
.
...
...
@@ -170,7 +170,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
//
and
check
if
we
should
merge
it
with
right
/
left
neighbours
if
ilo
+
1
<
len
(
M
.
entryv
)
{
//
right
if
M
.
entryv
[
ilo
].
Hi_
+
1
==
M
.
entryv
[
ilo
+
1
].
Lo
{
//
XXX
&&
.
v
alue
same
if
M
.
entryv
[
ilo
].
Hi_
+
1
==
M
.
entryv
[
ilo
+
1
].
Lo
{
//
XXX
&&
.
V
alue
same
vReplaceSlice
(&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
].
Lo
,
M
.
entryv
[
ilo
+
1
].
Hi_
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
...
...
@@ -178,7 +178,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
}
if
ilo
>
0
{
//
left
if
M
.
entryv
[
ilo
-
1
].
Hi_
+
1
==
M
.
entryv
[
ilo
].
Lo
{
//
XXX
&&
.
v
alue
same
if
M
.
entryv
[
ilo
-
1
].
Hi_
+
1
==
M
.
entryv
[
ilo
].
Lo
{
//
XXX
&&
.
V
alue
same
vReplaceSlice
(&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
].
Lo
,
M
.
entryv
[
ilo
].
Hi_
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
...
...
@@ -316,7 +316,7 @@ func (M *RangedMap) verify() {
for
i
,
e
:=
range
M
.
entryv
{
hiPrev
:=
hi_Prev
+
1
if
i
>
0
{
if
(
e
.
v
alue
==
v_Prev
)
{
if
(
e
.
V
alue
==
v_Prev
)
{
if
!(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
}
...
...
@@ -330,7 +330,7 @@ func (M *RangedMap) verify() {
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
}
hi_Prev
=
e
.
Hi_
v_Prev
=
e
.
v
alue
v_Prev
=
e
.
V
alue
}
}
...
...
@@ -389,7 +389,7 @@ func (M RangedMap) String() string {
func
(
e
*
RangedMapEntry
)
String
()
string
{
s
:=
e
.
keycov
.
String
()
v
:=
fmt
.
Sprintf
(
"%v"
,
e
.
v
alue
)
v
:=
fmt
.
Sprintf
(
"%v"
,
e
.
V
alue
)
if
v
!= "" { // omit ":<v>" in the case of set
s
+=
":"
+
v
}
...
...
wcfs/internal/xbtree/blib/rangeset.go
View file @
485f8c21
...
...
@@ -118,7 +118,7 @@ func (S *RangedKeySet) verify() {
// Clone returns copy of the set.
func
(
orig
*
RangedKeySet
)
Clone
()
*
RangedKeySet
{
return
&
RangedKeySet
{
orig
.
m
.
Clone
()}
return
&
RangedKeySet
{
*
orig
.
m
.
Clone
()}
}
// Empty returns whether the set is empty.
...
...
@@ -128,7 +128,7 @@ func (S *RangedKeySet) Empty() bool {
// Equal returns whether A == B.
func
(
A
*
RangedKeySet
)
Equal
(
B
*
RangedKeySet
)
bool
{
return
A
.
m
.
Equal
(
B
.
m
)
return
A
.
m
.
Equal
(
&
B
.
m
)
}
// Clear removes all elements from the set.
...
...
wcfs/internal/xbtree/blib/zrangemap_void.go
View file @
485f8c21
...
...
@@ -101,7 +101,7 @@ func (M *_RangedMap_void) Get_(k Key) (v void, ok bool) {
}
// found
return
e
.
v
alue
,
true
return
e
.
V
alue
,
true
}
// SetRange changes M to map key range r to value v.
...
...
@@ -172,7 +172,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
// and check if we should merge it with right/left neighbours
if
ilo
+
1
<
len
(
M
.
entryv
)
{
// right
if
M
.
entryv
[
ilo
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
+
1
]
.
Lo
{
// XXX && .
v
alue same
if
M
.
entryv
[
ilo
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
+
1
]
.
Lo
{
// XXX && .
V
alue same
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entryv
[
ilo
+
1
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
...
...
@@ -180,7 +180,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
}
if
ilo
>
0
{
// left
if
M
.
entryv
[
ilo
-
1
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
]
.
Lo
{
// XXX && .
v
alue same
if
M
.
entryv
[
ilo
-
1
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
]
.
Lo
{
// XXX && .
V
alue same
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entryv
[
ilo
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
...
...
@@ -318,7 +318,7 @@ func (M *_RangedMap_void) verify() {
for
i
,
e
:=
range
M
.
entryv
{
hiPrev
:=
hi_Prev
+
1
if
i
>
0
{
if
(
e
.
v
alue
==
v_Prev
)
{
if
(
e
.
V
alue
==
v_Prev
)
{
if
!
(
hiPrev
<
e
.
Lo
)
{
// NOTE not ≤ - adjacent ranges must be merged
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
}
...
...
@@ -332,7 +332,7 @@ func (M *_RangedMap_void) verify() {
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
}
hi_Prev
=
e
.
Hi_
v_Prev
=
e
.
v
alue
v_Prev
=
e
.
V
alue
}
}
...
...
@@ -391,7 +391,7 @@ func (M _RangedMap_void) String() string {
func
(
e
*
_RangedMap_voidEntry
)
String
()
string
{
s
:=
e
.
keycov
.
String
()
v
:=
fmt
.
Sprintf
(
"%v"
,
e
.
v
alue
)
v
:=
fmt
.
Sprintf
(
"%v"
,
e
.
V
alue
)
if
v
!=
""
{
// omit ":<v>" in the case of set
s
+=
":"
+
v
}
...
...
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