Alignment definitions should be added to RTCHitNt and RTCRayNt templates so they match the C definitions provided. The following static assertions demonstrate the issues with using the RTCRayNt templates as they all fail because RTCRayNt has an alignment of 4, equivalent to alignof(float).
As the alignment calculation in the PR is nasty as it avoids requiring the alignof keyword, or constexpr functions, this could instead be hidden behind a macro. Maybe RTC_ALIGN_SOA_AT_LEAST(N, MIN)?
The code is equivalent to:
constexpr std::size_t AlignSOAAtLeast(unsigned N, std::size_t min_alignment) noexcept {
if (std::has_single_bit<unsigned>(N)) {
return std::max<std::size_t>(min_alignment, N * alignof(float));
} else {
return min_alignment;
}
}
Alignment definitions should be added to RTCHitNt and RTCRayNt templates so they match the C definitions provided. The following static assertions demonstrate the issues with using the RTCRayNt templates as they all fail because RTCRayNt has an alignment of 4, equivalent to alignof(float).
As the alignment calculation in the PR is nasty as it avoids requiring the alignof keyword, or constexpr functions, this could instead be hidden behind a macro. Maybe RTC_ALIGN_SOA_AT_LEAST(N, MIN)?
The code is equivalent to: