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
3e875efe
Commit
3e875efe
authored
Sep 27, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5516f5a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
+27
-15
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+9
-5
wcfs/internal/xbtree/blib/zrangemap_str.go
wcfs/internal/xbtree/blib/zrangemap_str.go
+9
-5
wcfs/internal/xbtree/blib/zrangemap_void.go
wcfs/internal/xbtree/blib/zrangemap_void.go
+9
-5
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
3e875efe
...
...
@@ -41,7 +41,7 @@ type RangedMap struct {
//
RangedMapEntry
represents
one
entry
in
RangedMap
.
type
RangedMapEntry
struct
{
KeyRange
Value
VALUE
Value
VALUE
}
...
...
@@ -170,17 +170,21 @@ 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
&&
.
Value
same
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
vReplaceSlice
(&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
].
Lo
,
M
.
entryv
[
ilo
+
1
].
Hi_
})
RangedMapEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
if
ilo
>
0
{
//
left
if
M
.
entryv
[
ilo
-
1
].
Hi_
+
1
==
M
.
entryv
[
ilo
].
Lo
{
//
XXX
&&
.
Value
same
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
vReplaceSlice
(&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
].
Lo
,
M
.
entryv
[
ilo
].
Hi_
})
RangedMapEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
wcfs/internal/xbtree/blib/zrangemap_str.go
View file @
3e875efe
...
...
@@ -43,7 +43,7 @@ type _RangedMap_str struct {
// _RangedMap_strEntry represents one entry in _RangedMap_str.
type
_RangedMap_strEntry
struct
{
KeyRange
Value
string
Value
string
}
...
...
@@ -172,17 +172,21 @@ func (M *_RangedMap_str) SetRange(r KeyRange, v string) {
// 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 && .Value same
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entryv
[
ilo
+
1
]
.
Hi_
})
_RangedMap_strEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
debugf_RangedMap_str
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
if
ilo
>
0
{
// left
if
M
.
entryv
[
ilo
-
1
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
]
.
Lo
{
// XXX && .Value same
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entryv
[
ilo
]
.
Hi_
})
_RangedMap_strEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
debugf_RangedMap_str
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
wcfs/internal/xbtree/blib/zrangemap_void.go
View file @
3e875efe
...
...
@@ -43,7 +43,7 @@ type _RangedMap_void struct {
// _RangedMap_voidEntry represents one entry in _RangedMap_void.
type
_RangedMap_voidEntry
struct
{
KeyRange
Value
void
Value
void
}
...
...
@@ -172,17 +172,21 @@ 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 && .Value same
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
KeyRange
{
M
.
entryv
[
ilo
]
.
Lo
,
M
.
entryv
[
ilo
+
1
]
.
Hi_
})
_RangedMap_voidEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
if
ilo
>
0
{
// left
if
M
.
entryv
[
ilo
-
1
]
.
Hi_
+
1
==
M
.
entryv
[
ilo
]
.
Lo
{
// XXX && .Value same
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
KeyRange
{
M
.
entryv
[
ilo
-
1
]
.
Lo
,
M
.
entryv
[
ilo
]
.
Hi_
})
_RangedMap_voidEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
debugf_RangedMap_void
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
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