From fa19897016c03bfa9defb28632e31b1c0a150c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 4 Aug 2021 14:28:59 -0400 Subject: [PATCH] HexMap: align on 64 bits --- include/opendht/infohash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index f95728e4..7ea53b3d 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -342,7 +342,7 @@ Hash<N>::getRandom(Rd& rdev) return h; } -struct HexMap : public std::array<std::array<char, 2>, 256> { +struct alignas(std::max_align_t) HexMap : public std::array<std::array<char, 2>, 256> { HexMap() { for (size_t i=0; i<size(); i++) { auto& e = (*this)[i]; @@ -376,7 +376,7 @@ template <size_t N> const char* Hash<N>::to_c_str() const { - thread_local std::array<char, N*2+1> buf; + alignas(std::max_align_t) thread_local std::array<char, N*2+1> buf; for (size_t i=0; i<N; i++) { auto b = buf.data()+i*2; const auto& m = hex_map[data_[i]]; -- GitLab