From e259cb084729fa197c39d87211376326934e7dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Mon, 27 Jun 2022 14:09:23 -0400 Subject: [PATCH] infohash: remove optimization due to weird warnings Current operator== creates a very weird warning about using an uninitialized value (no warning without the reinterpret_cast). --- include/opendht/infohash.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index 414c528b..d4f2c7e4 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -103,11 +103,8 @@ public: static constexpr inline Hash zero() noexcept { return Hash{}; } bool operator==(const Hash& h) const { - auto a = reinterpret_cast<const uint32_t*>(data_.data()); - auto b = reinterpret_cast<const uint32_t*>(h.data_.data()); - constexpr unsigned n = N / sizeof(uint32_t); - for (unsigned i=0; i < n; i++) - if (a[i] != b[i]) + for (unsigned i=0; i < N; i++) + if (data_[i] != h.data_[i]) return false; return true; } -- GitLab