diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index a6fcede53bc5c4ef091efb137d99b795083b7ef1..a73402091fad3f55f2a075dd4c0fa95b24bc6d3b 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -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) { diff --git a/src/utils.cpp b/src/utils.cpp index 4a4ada33cd1abd45d2982e927b21342f1752b5d5..2af58854f03bd21d647ad3f298ca5ed7ac282d2e 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -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>