From a1391d52a2303eeb41dccbe0b8bb96ecb150daaa Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 1 Aug 2026 13:37:39 -0400 Subject: [PATCH] ldpctool: Remove VLAs from MinSumAlgorithm Replace variable length arrays in the float specialization of MinSumAlgorithm::finalp() with std::vector storage. This removes reliance on compiler VLA extensions and keeps the temporary buffers managed by standard C++ containers. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/ldpctool/generic.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/channelrx/demoddatv/ldpctool/generic.h b/plugins/channelrx/demoddatv/ldpctool/generic.h index d44a9b8c9..dc84fec0f 100644 --- a/plugins/channelrx/demoddatv/ldpctool/generic.h +++ b/plugins/channelrx/demoddatv/ldpctool/generic.h @@ -121,18 +121,20 @@ struct MinSumAlgorithm static void finalp(float *links, int cnt) { int mask = 0x80000000; - float mags[cnt], mins[cnt]; + std::vector mags(cnt), mins(cnt); + std::vector signs(cnt); + for (int i = 0; i < cnt; ++i) mags[i] = std::abs(links[i]); - CODE::exclusive_reduce(mags, mins, cnt, min); - int signs[cnt]; - CODE::exclusive_reduce(reinterpret_cast(links), signs, cnt, xor_); + CODE::exclusive_reduce(mags.data(), mins.data(), cnt, min); + CODE::exclusive_reduce(reinterpret_cast(links), signs.data(), cnt, xor_); + for (int i = 0; i < cnt; ++i) signs[i] &= mask; for (int i = 0; i < cnt; ++i) - reinterpret_cast(links)[i] = signs[i] | reinterpret_cast(mins)[i]; + reinterpret_cast(links)[i] = signs[i] | reinterpret_cast(mins.data())[i]; } static float sign(float a, float b) {