Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
b
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
b
Commits
86981b11
Commit
86981b11
authored
Apr 11, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
171c18f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
btree.go
btree.go
+19
-6
No files found.
btree.go
View file @
86981b11
...
...
@@ -707,6 +707,15 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
//dbg("\tpi -> %v", pi)
q
=
p
.
x
[
pi
]
.
ch
if
pi
>
0
{
hitKminPrev
:=
hitKmin
hitKmin
.
set
(
p
.
x
[
pi
-
1
]
.
k
)
if
hitKminPrev
.
kset
&&
t
.
cmp
(
hitKmin
.
k
,
hitKminPrev
.
k
)
<=
0
{
bad
(
"hitKmin not ↑: %v -> %v"
,
hitKminPrev
.
k
,
hitKmin
.
k
)
}
}
if
pi
<
p
.
c
{
//dbg("", p.x, pi)
hitKmax
.
set
(
p
.
x
[
pi
]
.
k
)
// XXX not sure or x[pi+1] ?
...
...
@@ -727,12 +736,8 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
}
}
if
dd
!=
t
.
hitD
||
i
!=
t
.
hitDi
{
bad
(
"hitD mismatch: %v @%d ; want %v @%d"
,
t
.
hitD
,
t
.
hitDi
,
dd
,
i
)
}
if
p
!=
t
.
hitP
||
pi
!=
t
.
hitPi
{
bad
(
"hitP mismatch: %v @%d ; want %v @%d"
,
t
.
hitP
,
t
.
hitPi
,
p
,
pi
)
if
hitKmin
!=
t
.
hitKmin
{
bad
(
"hitKmin mismatch: %v ; want %v"
,
t
.
hitKmin
,
hitKmin
)
}
if
hitKmax
!=
t
.
hitKmax
{
...
...
@@ -744,6 +749,14 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
}
if
dd
!=
t
.
hitD
||
i
!=
t
.
hitDi
{
bad
(
"hitD mismatch: %v @%d ; want %v @%d"
,
t
.
hitD
,
t
.
hitDi
,
dd
,
i
)
}
if
p
!=
t
.
hitP
||
pi
!=
t
.
hitPi
{
bad
(
"hitP mismatch: %v @%d ; want %v @%d"
,
t
.
hitP
,
t
.
hitPi
,
p
,
pi
)
}
v2
,
ok
:=
t
.
Get
(
k
)
if
!
ok
||
v2
!=
v
{
bad
(
"get(%v) -> %v, %v; want %v, %v"
,
k
,
v2
,
ok
,
v
,
true
)
...
...
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