Commit 76548f86 by Abseil Team Committed by Copybara-Service

Ensure arrays are 16-byte aligned before casting to uint128

PiperOrigin-RevId: 541111597
Change-Id: I88165130e30e548a03d8d6173dadab33dc18b21e
parent 049aa40e
......@@ -47,8 +47,10 @@ static constexpr size_t kSeedSizeT = Randen::kSeedBytes / sizeof(uint32_t);
// Randen implementation benchmarks.
template <typename T>
struct AbsorbFn : public T {
mutable uint64_t state[kStateSizeT] = {};
mutable uint32_t seed[kSeedSizeT] = {};
// These are both cast to uint128* in the RandenHwAes implementation, so
// ensure they are 16 byte aligned.
alignas(16) mutable uint64_t state[kStateSizeT] = {};
alignas(16) mutable uint32_t seed[kSeedSizeT] = {};
static constexpr size_t bytes() { return sizeof(seed); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment