diff --git a/filament/backend/include/backend/DriverEnums.h b/filament/backend/include/backend/DriverEnums.h index e25f18dafd..8598114a44 100644 --- a/filament/backend/include/backend/DriverEnums.h +++ b/filament/backend/include/backend/DriverEnums.h @@ -813,22 +813,22 @@ struct SamplerParams { // NOLINT struct Hasher { size_t operator()(SamplerParams p) const noexcept { // we don't use std::hash<> here, so we don't have to include - return *reinterpret_cast(reinterpret_cast(&p)); + return *reinterpret_cast(reinterpret_cast(&p)); } }; struct EqualTo { bool operator()(SamplerParams lhs, SamplerParams rhs) const noexcept { - auto* pLhs = reinterpret_cast(reinterpret_cast(&lhs)); - auto* pRhs = reinterpret_cast(reinterpret_cast(&rhs)); + auto* pLhs = reinterpret_cast(reinterpret_cast(&lhs)); + auto* pRhs = reinterpret_cast(reinterpret_cast(&rhs)); return *pLhs == *pRhs; } }; struct LessThan { bool operator()(SamplerParams lhs, SamplerParams rhs) const noexcept { - auto* pLhs = reinterpret_cast(reinterpret_cast(&lhs)); - auto* pRhs = reinterpret_cast(reinterpret_cast(&rhs)); + auto* pLhs = reinterpret_cast(reinterpret_cast(&lhs)); + auto* pRhs = reinterpret_cast(reinterpret_cast(&rhs)); return *pLhs == *pRhs; } }; @@ -838,6 +838,7 @@ private: return SamplerParams::LessThan{}(lhs, rhs); } }; +static_assert(sizeof(SamplerParams) == 4); // The limitation to 64-bits max comes from how we store a SamplerParams in our JNI code // see android/.../TextureSampler.cpp