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

HexMap: align on 64 bits

parent 38063555
No related branches found
No related tags found
No related merge requests found
...@@ -342,7 +342,7 @@ Hash<N>::getRandom(Rd& rdev) ...@@ -342,7 +342,7 @@ Hash<N>::getRandom(Rd& rdev)
return h; 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() { HexMap() {
for (size_t i=0; i<size(); i++) { for (size_t i=0; i<size(); i++) {
auto& e = (*this)[i]; auto& e = (*this)[i];
...@@ -376,7 +376,7 @@ template <size_t N> ...@@ -376,7 +376,7 @@ template <size_t N>
const char* const char*
Hash<N>::to_c_str() const 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++) { for (size_t i=0; i<N; i++) {
auto b = buf.data()+i*2; auto b = buf.data()+i*2;
const auto& m = hex_map[data_[i]]; const auto& m = hex_map[data_[i]];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment