Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a334c19b
Commit
a334c19b
authored
Apr 19, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix node_id::compare
parent
001a9721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+10
-8
No files found.
libcaf_core/src/node_id.cpp
View file @
a334c19b
...
@@ -82,14 +82,16 @@ int node_id::compare(const node_id& other) const {
...
@@ -82,14 +82,16 @@ int node_id::compare(const node_id& other) const {
return
0
;
// shortcut for comparing to self or identical instances
return
0
;
// shortcut for comparing to self or identical instances
if
(
!
data_
!=
!
other
.
data_
)
if
(
!
data_
!=
!
other
.
data_
)
return
data_
?
1
:
-
1
;
// invalid instances are always smaller
return
data_
?
1
:
-
1
;
// invalid instances are always smaller
int
tmp
=
strncmp
(
reinterpret_cast
<
const
char
*>
(
host_id
().
data
()),
// use mismatch instead of strncmp because the
reinterpret_cast
<
const
char
*>
(
other
.
host_id
().
data
()),
// latter bails out on the first 0-byte
host_id_size
);
auto
last
=
host_id
().
end
();
return
tmp
!=
0
auto
ipair
=
std
::
mismatch
(
host_id
().
begin
(),
last
,
other
.
host_id
().
begin
());
?
tmp
if
(
ipair
.
first
==
last
)
:
(
process_id
()
<
other
.
process_id
()
return
static_cast
<
int
>
(
process_id
())
-
static_cast
<
int
>
(
other
.
process_id
());
?
-
1
else
if
(
*
ipair
.
first
<
*
ipair
.
second
)
:
(
process_id
()
==
other
.
process_id
()
?
0
:
1
));
return
-
1
;
else
return
1
;
}
}
node_id
::
data
::
data
()
:
pid_
(
0
)
{
node_id
::
data
::
data
()
:
pid_
(
0
)
{
...
...
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