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) {
...
@@ -99,7 +99,7 @@ func (M *RangedMap) Get_(k Key) (v VALUE, ok bool) {
}
}
//
found
//
found
return
e
.
v
alue
,
true
return
e
.
V
alue
,
true
}
}
//
SetRange
changes
M
to
map
key
range
r
to
value
v
.
//
SetRange
changes
M
to
map
key
range
r
to
value
v
.
...
@@ -170,7 +170,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
...
@@ -170,7 +170,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
//
and
check
if
we
should
merge
it
with
right
/
left
neighbours
//
and
check
if
we
should
merge
it
with
right
/
left
neighbours
if
ilo
+
1
<
len
(
M
.
entryv
)
{
//
right
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
,
vReplaceSlice
(&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
].
Lo
,
M
.
entryv
[
ilo
+
1
].
Hi_
})
KeyRange
{
M
.
entryv
[
ilo
].
Lo
,
M
.
entryv
[
ilo
+
1
].
Hi_
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
...
@@ -178,7 +178,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
...
@@ -178,7 +178,7 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
}
}
if
ilo
>
0
{
//
left
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
,
vReplaceSlice
(&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
].
Lo
,
M
.
entryv
[
ilo
].
Hi_
})
KeyRange
{
M
.
entryv
[
ilo
-
1
].
Lo
,
M
.
entryv
[
ilo
].
Hi_
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
...
@@ -316,7 +316,7 @@ func (M *RangedMap) verify() {
...
@@ -316,7 +316,7 @@ func (M *RangedMap) verify() {
for
i
,
e
:=
range
M
.
entryv
{
for
i
,
e
:=
range
M
.
entryv
{
hiPrev
:=
hi_Prev
+
1
hiPrev
:=
hi_Prev
+
1
if
i
>
0
{
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
if
!(hiPrev < e.Lo) { // NOTE not ≤ - adjacent ranges must be merged
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
}
}
...
@@ -330,7 +330,7 @@ func (M *RangedMap) verify() {
...
@@ -330,7 +330,7 @@ func (M *RangedMap) verify() {
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
}
}
hi_Prev
=
e
.
Hi_
hi_Prev
=
e
.
Hi_
v_Prev
=
e
.
v
alue
v_Prev
=
e
.
V
alue
}
}
}
}
...
@@ -389,7 +389,7 @@ func (M RangedMap) String() string {
...
@@ -389,7 +389,7 @@ func (M RangedMap) String() string {
func
(
e
*
RangedMapEntry
)
String
()
string
{
func
(
e
*
RangedMapEntry
)
String
()
string
{
s
:=
e
.
keycov
.
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
if
v
!= "" { // omit ":<v>" in the case of set
s
+=
":"
+
v
s
+=
":"
+
v
}
}
...
...
wcfs/internal/xbtree/blib/rangeset.go
View file @
485f8c21
...
@@ -118,7 +118,7 @@ func (S *RangedKeySet) verify() {
...
@@ -118,7 +118,7 @@ func (S *RangedKeySet) verify() {
// Clone returns copy of the set.
// Clone returns copy of the set.
func
(
orig
*
RangedKeySet
)
Clone
()
*
RangedKeySet
{
func
(
orig
*
RangedKeySet
)
Clone
()
*
RangedKeySet
{
return
&
RangedKeySet
{
orig
.
m
.
Clone
()}
return
&
RangedKeySet
{
*
orig
.
m
.
Clone
()}
}
}
// Empty returns whether the set is empty.
// Empty returns whether the set is empty.
...
@@ -128,7 +128,7 @@ func (S *RangedKeySet) Empty() bool {
...
@@ -128,7 +128,7 @@ func (S *RangedKeySet) Empty() bool {
// Equal returns whether A == B.
// Equal returns whether A == B.
func
(
A
*
RangedKeySet
)
Equal
(
B
*
RangedKeySet
)
bool
{
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.
// 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) {
...
@@ -101,7 +101,7 @@ func (M *_RangedMap_void) Get_(k Key) (v void, ok bool) {
}
}
// found
// found
return
e
.
v
alue
,
true
return
e
.
V
alue
,
true
}
}
// SetRange changes M to map key range r to value v.
// SetRange changes M to map key range r to value v.
...
@@ -172,7 +172,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
...
@@ -172,7 +172,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
// and check if we should merge it with right/left neighbours
// and check if we should merge it with right/left neighbours
if
ilo
+
1
<
len
(
M
.
entryv
)
{
// right
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
,
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entryv
[
ilo
+
1
]
.
Hi_
})
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entryv
[
ilo
+
1
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
...
@@ -180,7 +180,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
...
@@ -180,7 +180,7 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
}
}
if
ilo
>
0
{
// left
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
,
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entryv
[
ilo
]
.
Hi_
})
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entryv
[
ilo
]
.
Hi_
})
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
...
@@ -318,7 +318,7 @@ func (M *_RangedMap_void) verify() {
...
@@ -318,7 +318,7 @@ func (M *_RangedMap_void) verify() {
for
i
,
e
:=
range
M
.
entryv
{
for
i
,
e
:=
range
M
.
entryv
{
hiPrev
:=
hi_Prev
+
1
hiPrev
:=
hi_Prev
+
1
if
i
>
0
{
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
if
!
(
hiPrev
<
e
.
Lo
)
{
// NOTE not ≤ - adjacent ranges must be merged
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
badf
(
"[%d]: same value: !(hiPrev < e.lo)"
,
i
)
}
}
...
@@ -332,7 +332,7 @@ func (M *_RangedMap_void) verify() {
...
@@ -332,7 +332,7 @@ func (M *_RangedMap_void) verify() {
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
badf
(
"[%d]: !(e.lo ≤ e.hi_)"
,
i
)
}
}
hi_Prev
=
e
.
Hi_
hi_Prev
=
e
.
Hi_
v_Prev
=
e
.
v
alue
v_Prev
=
e
.
V
alue
}
}
}
}
...
@@ -391,7 +391,7 @@ func (M _RangedMap_void) String() string {
...
@@ -391,7 +391,7 @@ func (M _RangedMap_void) String() string {
func
(
e
*
_RangedMap_voidEntry
)
String
()
string
{
func
(
e
*
_RangedMap_voidEntry
)
String
()
string
{
s
:=
e
.
keycov
.
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
if
v
!=
""
{
// omit ":<v>" in the case of set
s
+=
":"
+
v
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