Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-cidranger
Commits
55e7924a
Commit
55e7924a
authored
Aug 28, 2017
by
Yulin Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder functions in trie
parent
5b66601c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
ranger/trie/trie.go
ranger/trie/trie.go
+10
-10
No files found.
ranger/trie/trie.go
View file @
55e7924a
...
...
@@ -86,16 +86,6 @@ func (p *PrefixTrie) Remove(network net.IPNet) (*net.IPNet, error) {
return
p
.
remove
(
rnet
.
NewNetwork
(
network
))
}
func
(
p
*
PrefixTrie
)
childrenCount
()
int
{
count
:=
0
for
_
,
child
:=
range
p
.
children
{
if
child
!=
nil
{
count
++
}
}
return
count
}
// Contains returns boolean indicating whether given ip is contained in any
// of the inserted networks.
func
(
p
*
PrefixTrie
)
Contains
(
ip
net
.
IP
)
(
bool
,
error
)
{
...
...
@@ -257,6 +247,16 @@ func (p *PrefixTrie) remove(network rnet.Network) (*net.IPNet, error) {
return
nil
,
nil
}
func
(
p
*
PrefixTrie
)
childrenCount
()
int
{
count
:=
0
for
_
,
child
:=
range
p
.
children
{
if
child
!=
nil
{
count
++
}
}
return
count
}
func
(
p
*
PrefixTrie
)
targetBitPosition
()
uint
{
return
31
-
p
.
numBitsSkipped
}
...
...
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