Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
savoirfairelinux
opendht
Commits
352e3650
Commit
352e3650
authored
1 month ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
utils: make HexMap constexpr
parent
7397bd61
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/infohash.h
+3
-3
3 additions, 3 deletions
include/opendht/infohash.h
src/utils.cpp
+0
-2
0 additions, 2 deletions
src/utils.cpp
with
3 additions
and
5 deletions
include/opendht/infohash.h
+
3
−
3
View file @
352e3650
...
...
@@ -110,7 +110,7 @@ public:
bool
operator
!=
(
const
Hash
&
h
)
const
{
return
!
(
*
this
==
h
);
}
bool
operator
<
(
const
Hash
&
o
)
const
{
for
(
unsigned
i
=
0
;
i
<
N
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
N
;
i
++
)
{
if
(
data_
[
i
]
!=
o
.
data_
[
i
])
return
data_
[
i
]
<
o
.
data_
[
i
];
}
...
...
@@ -119,7 +119,7 @@ public:
Hash
operator
^
(
const
Hash
&
o
)
const
{
Hash
result
;
for
(
auto
i
=
0u
;
i
<
N
;
i
++
)
{
for
(
auto
i
=
0u
;
i
<
N
;
i
++
)
{
result
[
i
]
=
data_
[
i
]
^
o
.
data_
[
i
];
}
return
result
;
...
...
@@ -356,7 +356,7 @@ private:
static
constexpr
const
char
*
hex_digits
=
"0123456789abcdef"
;
};
OPENDHT_PUBLIC
extern
const
HexMap
hex_map
;
OPENDHT_PUBLIC
const
expr
HexMap
hex_map
=
{}
;
inline
std
::
string
toHex
(
const
uint8_t
*
data
,
size_t
size
)
{
...
...
This diff is collapsed.
Click to expand it.
src/utils.cpp
+
0
−
2
View file @
352e3650
...
...
@@ -39,8 +39,6 @@ const char* version() {
return
PACKAGE_VERSION
;
}
const
HexMap
hex_map
=
{};
static
constexpr
std
::
array
<
uint8_t
,
12
>
MAPPED_IPV4_PREFIX
{{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xff
,
0xff
}};
std
::
pair
<
std
::
string
,
std
::
string
>
...
...
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