Skip to content
Snippets Groups Projects
Commit 352e3650 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

utils: make HexMap constexpr

parent 7397bd61
Branches
Tags
No related merge requests found
......@@ -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 constexpr HexMap hex_map = {};
inline std::string
toHex(const uint8_t* data, size_t size) {
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment