aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-31 09:08:21 -0800
committerChris Robinson <[email protected]>2023-12-31 09:08:21 -0800
commitc01824052b95636fecbe2f30d77aba6d542418a0 (patch)
tree9c8e9195041896146b1d7269fda9e530ac29a9fc
parent1dbb8a83e0dbf9ec7cad32815b3aceac54de706e (diff)
Ensure HrtfStore alignment is large enough
-rw-r--r--core/hrtf.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index d56c364e..80e38709 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -382,6 +382,10 @@ std::unique_ptr<HrtfStore> CreateHrtfStore(uint rate, uint8_t irSize,
const al::span<const HrtfStore::Elevation> elevs, const HrirArray *coeffs,
const ubyte2 *delays, const char *filename)
{
+ static_assert(alignof(HrtfStore::Field) <= alignof(HrtfStore));
+ static_assert(alignof(HrtfStore::Elevation) <= alignof(HrtfStore));
+ static_assert(16 <= alignof(HrtfStore));
+
const size_t irCount{size_t{elevs.back().azCount} + elevs.back().irOffset};
size_t total{sizeof(HrtfStore)};
total = RoundUp(total, alignof(HrtfStore::Field)); /* Align for field infos */