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
1a76bee1
Commit
1a76bee1
authored
Apr 13, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0ac4fdc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
btree.go
btree.go
+4
-3
No files found.
btree.go
View file @
1a76bee1
...
@@ -317,7 +317,7 @@ func (t *Tree) Delete(k interface{} /*K*/) (ok bool) {
...
@@ -317,7 +317,7 @@ func (t *Tree) Delete(k interface{} /*K*/) (ok bool) {
// check if we can do the delete nearby previous change
// check if we can do the delete nearby previous change
i
,
ok
:=
t
.
hitFind
(
k
)
i
,
ok
:=
t
.
hitFind
(
k
)
if
i
>=
0
{
if
i
>=
0
{
dbg
(
"hit found
\t
-> %d, %v"
,
i
,
ok
)
//
dbg("hit found\t-> %d, %v", i, ok)
dd
:=
t
.
hitD
dd
:=
t
.
hitD
switch
{
switch
{
...
@@ -531,7 +531,8 @@ func (t *Tree) find2(d *d, k interface{} /*K*/, l, h int) (i int, ok bool) {
...
@@ -531,7 +531,8 @@ func (t *Tree) find2(d *d, k interface{} /*K*/, l, h int) (i int, ok bool) {
// - i: index corresponding to data entry in t.hitD with min(k' : k <= k')
// - i: index corresponding to data entry in t.hitD with min(k' : k <= k')
// - ok: whether k' == k
// - ok: whether k' == k
func
(
t
*
Tree
)
hitFind
(
k
interface
{}
/*K*/
)
(
i
int
,
ok
bool
)
{
func
(
t
*
Tree
)
hitFind
(
k
interface
{}
/*K*/
)
(
i
int
,
ok
bool
)
{
return
-
1
,
false
// XXX for testing how hit{Kmin,Kmax} are computed on all test keys
// XXX reenable to test how slow path computes hit{Kmin,Kmax} on all keys
//return -1, false
hit
:=
t
.
hitD
hit
:=
t
.
hitD
if
hit
==
nil
{
if
hit
==
nil
{
...
@@ -734,7 +735,7 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
...
@@ -734,7 +735,7 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
// check if we can do the update nearby previous change
// check if we can do the update nearby previous change
i
,
ok
:=
t
.
hitFind
(
k
)
i
,
ok
:=
t
.
hitFind
(
k
)
if
i
>=
0
{
if
i
>=
0
{
dbg
(
"hit found
\t
-> %d, %v"
,
i
,
ok
)
//
dbg("hit found\t-> %d, %v", i, ok)
dd
:=
t
.
hitD
dd
:=
t
.
hitD
switch
{
switch
{
...
...
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