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
fb34c8b7
Commit
fb34c8b7
authored
Sep 27, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3e875efe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+7
-6
wcfs/internal/xbtree/blib/zrangemap_str.go
wcfs/internal/xbtree/blib/zrangemap_str.go
+7
-6
wcfs/internal/xbtree/blib/zrangemap_void.go
wcfs/internal/xbtree/blib/zrangemap_void.go
+7
-6
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
fb34c8b7
...
...
@@ -142,11 +142,12 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
debugfRMap
(
"
\t
jhi: %d
\n
"
,
jhi
)
//
entries
in
[
ilo
:
jhi
)
∈
[
r
.
Lo
,
r
.
hi
)
and
should
be
merged
into
one
//
XXX
check
different
values
//
FIXME
check
different
values
if
(
jhi
-
ilo
)
>
1
{
lo
:=
M
.
entryv
[
ilo
].
Lo
hi_
:=
M
.
entryv
[
jhi
-
1
].
Hi_
vReplaceSlice
(&
M
.
entryv
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
//
vReplaceSlice
(&
M
.
entryv
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
vReplaceSlice
(&
M
.
entryv
,
ilo
,
jhi
,
RangedMapEntry
{
KeyRange
{
lo
,
hi_
},
v
})
debugfRMap
(
"
\t
merge M[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
M
)
}
jhi
=
-
1
//
no
longer
valid
...
...
@@ -172,9 +173,9 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
if
ilo
+
1
<
len
(
M
.
entryv
)
{
//
right
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
v
==
right
.
Value
)
{
vReplaceSlice
(&
M
.
entryv
,
ilo
,
ilo
+
2
,
RangedMapEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
RangedMapEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
v
})
debugfRMap
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
...
...
@@ -182,9 +183,9 @@ func (M *RangedMap) SetRange(r KeyRange, v VALUE) {
if
ilo
>
0
{
//
left
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
v
)
{
vReplaceSlice
(&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
RangedMapEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
RangedMapEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
v
})
debugfRMap
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
wcfs/internal/xbtree/blib/zrangemap_str.go
View file @
fb34c8b7
...
...
@@ -144,11 +144,12 @@ func (M *_RangedMap_str) SetRange(r KeyRange, v string) {
debugf_RangedMap_str
(
"
\t
jhi: %d
\n
"
,
jhi
)
// entries in [ilo:jhi) ∈ [r.Lo,r.hi) and should be merged into one
//
XXX
check different values
//
FIXME
check different values
if
(
jhi
-
ilo
)
>
1
{
lo
:=
M
.
entryv
[
ilo
]
.
Lo
hi_
:=
M
.
entryv
[
jhi
-
1
]
.
Hi_
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
//vReplaceSlice__RangedMap_str(&M.entryv, ilo,jhi, KeyRange{lo,hi_})
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
,
jhi
,
_RangedMap_strEntry
{
KeyRange
{
lo
,
hi_
},
v
})
debugf_RangedMap_str
(
"
\t
merge M[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
M
)
}
jhi
=
-
1
// no longer valid
...
...
@@ -174,9 +175,9 @@ func (M *_RangedMap_str) SetRange(r KeyRange, v string) {
if
ilo
+
1
<
len
(
M
.
entryv
)
{
// right
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
v
==
right
.
Value
)
{
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
_RangedMap_strEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
_RangedMap_strEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
v
})
debugf_RangedMap_str
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
...
...
@@ -184,9 +185,9 @@ func (M *_RangedMap_str) SetRange(r KeyRange, v string) {
if
ilo
>
0
{
// left
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
v
)
{
vReplaceSlice__RangedMap_str
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
_RangedMap_strEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
_RangedMap_strEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
v
})
debugf_RangedMap_str
(
"
\t
merge left
\t
-> %s
\n
"
,
M
)
}
}
...
...
wcfs/internal/xbtree/blib/zrangemap_void.go
View file @
fb34c8b7
...
...
@@ -144,11 +144,12 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
debugf_RangedMap_void
(
"
\t
jhi: %d
\n
"
,
jhi
)
// entries in [ilo:jhi) ∈ [r.Lo,r.hi) and should be merged into one
//
XXX
check different values
//
FIXME
check different values
if
(
jhi
-
ilo
)
>
1
{
lo
:=
M
.
entryv
[
ilo
]
.
Lo
hi_
:=
M
.
entryv
[
jhi
-
1
]
.
Hi_
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
jhi
,
KeyRange
{
lo
,
hi_
})
//vReplaceSlice__RangedMap_void(&M.entryv, ilo,jhi, KeyRange{lo,hi_})
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
jhi
,
_RangedMap_voidEntry
{
KeyRange
{
lo
,
hi_
},
v
})
debugf_RangedMap_void
(
"
\t
merge M[%d:%d]
\t
-> %s
\n
"
,
ilo
,
jhi
,
M
)
}
jhi
=
-
1
// no longer valid
...
...
@@ -174,9 +175,9 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
if
ilo
+
1
<
len
(
M
.
entryv
)
{
// right
x
:=
M
.
entryv
[
ilo
]
right
:=
M
.
entryv
[
ilo
+
1
]
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
x
.
Value
==
right
.
Value
)
{
if
(
x
.
Hi_
+
1
==
right
.
Lo
)
&&
(
v
==
right
.
Value
)
{
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
,
ilo
+
2
,
_RangedMap_voidEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
x
.
Value
})
_RangedMap_voidEntry
{
KeyRange
{
x
.
Lo
,
right
.
Hi_
},
v
})
debugf_RangedMap_void
(
"
\t
merge right
\t
-> %s
\n
"
,
M
)
}
}
...
...
@@ -184,9 +185,9 @@ func (M *_RangedMap_void) SetRange(r KeyRange, v void) {
if
ilo
>
0
{
// left
left
:=
M
.
entryv
[
ilo
-
1
]
x
:=
M
.
entryv
[
ilo
]
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
x
.
Value
)
{
if
(
left
.
Hi_
+
1
==
x
.
Lo
)
&&
(
left
.
Value
==
v
)
{
vReplaceSlice__RangedMap_void
(
&
M
.
entryv
,
ilo
-
1
,
ilo
+
1
,
_RangedMap_voidEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
x
.
Value
})
_RangedMap_voidEntry
{
KeyRange
{
left
.
Lo
,
x
.
Hi_
},
v
})
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