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
c72e341b
Commit
c72e341b
authored
Apr 13, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8332deee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
btree.go
btree.go
+17
-20
No files found.
btree.go
View file @
c72e341b
...
...
@@ -122,7 +122,7 @@ type (
}
xkey
struct
{
// key + whether value is present at all
k
interface
{}
/*K*/
k
interface
{}
/*K*/
kset
bool
// if not set - k not present
}
)
...
...
@@ -532,8 +532,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) {
return
-
1
,
false
}
return
t
.
find2
(
hit
,
k
,
i
+
1
,
hit
.
c
-
1
)
return
t
.
find2
(
hit
,
k
,
i
+
1
,
hit
.
c
-
1
)
case
cmp
<
0
:
if
t
.
hitKmin
.
kset
&&
t
.
cmp
(
k
,
t
.
hitKmin
.
k
)
<
0
{
...
...
@@ -544,7 +543,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) {
return
t
.
find2
(
hit
,
k
,
0
,
i
)
default
:
return
i
,
true
;
return
i
,
true
}
}
...
...
@@ -644,7 +643,7 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{
t
.
hitKmin
.
set
(
k
)
t
.
hitKmax
=
t
.
hitPKmax
if
pi
+
1
<
p
.
c
{
// means < ∞
if
pi
+
1
<
p
.
c
{
// means < ∞
t
.
hitKmax
.
set
(
p
.
x
[
pi
+
1
]
.
k
)
}
t
.
hitPi
=
pi
+
1
...
...
@@ -715,7 +714,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
// dbg("--- POST\n%s\n====\n", t.dump())
//}()
// check if we can do the update nearby previous change
i
,
ok
:=
t
.
hitFind
(
k
)
if
i
>=
0
{
...
...
@@ -784,7 +782,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
t
.
hitKmax
.
set
(
p
.
x
[
pi
]
.
k
)
}
case
*
d
:
// data page found - perform the update
t
.
hitP
=
p
...
...
@@ -928,7 +925,7 @@ func (t *Tree) split(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{} /
t
.
insert
(
r
,
i
-
kd
,
k
,
v
)
t
.
hitKmin
.
set
(
p
.
x
[
pi
]
.
k
)
kmax
:=
t
.
hitPKmax
if
pi
+
1
<
p
.
c
{
if
pi
+
1
<
p
.
c
{
kmax
.
set
(
p
.
x
[
pi
+
1
]
.
k
)
}
t
.
hitKmax
=
kmax
...
...
@@ -963,7 +960,7 @@ func (t *Tree) splitX(p *x, q *x, pi int, i int) (*x, int) {
i
-=
kx
+
1
t
.
hitKmin
.
set
(
p
.
x
[
pi
]
.
k
)
t
.
hitKmax
=
t
.
hitPKmax
if
pi
+
1
<
p
.
c
{
// means < ∞
if
pi
+
1
<
p
.
c
{
// means < ∞
t
.
hitKmax
.
set
(
p
.
x
[
pi
+
1
]
.
k
)
}
}
else
{
...
...
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