diff --git a/projects/hip-tests/catch/include/hip_test_rtc.hh b/projects/hip-tests/catch/include/hip_test_rtc.hh index 0f862840bb..11ef6a1656 100644 --- a/projects/hip-tests/catch/include/hip_test_rtc.hh +++ b/projects/hip-tests/catch/include/hip_test_rtc.hh @@ -77,11 +77,7 @@ inline std::vector alignArguments(std::vector& args) { for (auto& arg : args) { const char* argPtr{reinterpret_cast(arg.ptr)}; - /* - * Details about the padding formula can be found at: - * https://en.wikipedia.org/wiki/Data_structure_alignment#Data_structure_padding - */ - int paddingNeeded = -count & (arg.alignmentRequirement - 1); + int paddingNeeded = (arg.alignmentRequirement - 1) & (~count + 1); alignedArguments.insert(std::end(alignedArguments), paddingNeeded, 0); count += paddingNeeded;