Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
02bfd001
Unverified
Commit
02bfd001
authored
5 years ago
by
Christoph Petrausch
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #234 from bio-routing/fix/pfxdedup
Fix/pfxdedup
parents
9a2f84b2
2f52452b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
net/prefix.go
+7
-3
7 additions, 3 deletions
net/prefix.go
with
7 additions
and
3 deletions
net/prefix.go
+
7
−
3
View file @
02bfd001
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
gonet
"net"
gonet
"net"
"strconv"
"strconv"
"strings"
"strings"
"unsafe"
"github.com/bio-routing/bio-rd/net/api"
"github.com/bio-routing/bio-rd/net/api"
"github.com/google/btree"
"github.com/google/btree"
...
@@ -26,11 +25,16 @@ func (p *Prefix) Dedup() *Prefix {
...
@@ -26,11 +25,16 @@ func (p *Prefix) Dedup() *Prefix {
// Less compares prefixes for use in btree.Btree
// Less compares prefixes for use in btree.Btree
func
(
p
*
Prefix
)
Less
(
other
btree
.
Item
)
bool
{
func
(
p
*
Prefix
)
Less
(
other
btree
.
Item
)
bool
{
if
uintptr
(
unsafe
.
Pointer
(
p
.
addr
))
<
uintptr
(
unsafe
.
Pointer
(
other
.
(
*
Prefix
)
.
addr
))
{
switch
p
.
addr
.
Compare
(
other
.
(
*
Prefix
)
.
addr
)
{
case
0
:
return
p
.
pfxlen
<
other
.
(
*
Prefix
)
.
pfxlen
case
-
1
:
return
true
return
true
case
1
:
return
false
}
}
return
p
.
pfxlen
<
other
.
(
*
Prefix
)
.
pfxlen
return
false
}
}
// DedupWithIP gets a copy of Prefix from the cache and dedups the IP part
// DedupWithIP gets a copy of Prefix from the cache and dedups the IP part
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment