From 3a0a0facdfebcdb482676feade81712f5c032d06 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Jun 2022 14:12:29 +0200 Subject: [PATCH] util/SpanCast: suppress alignment warnings --- src/util/SpanCast.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/SpanCast.hxx b/src/util/SpanCast.hxx index a1bccac63..0ca95bc40 100644 --- a/src/util/SpanCast.hxx +++ b/src/util/SpanCast.hxx @@ -47,8 +47,11 @@ FromBytesFloor(std::span> other) noexcept { static_assert(sizeof(T) > 0, "Empty base type"); + /* TODO: the "void *" cast suppresses alignment + warnings, but should we really suppress them? */ + return { - reinterpret_cast(other.data()), + reinterpret_cast(reinterpret_cast *>(other.data())), other.size() / sizeof(T), }; }