From 4b3bf214180b1b2a7e07fbc1300dd64179a159cc Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 1 Aug 2026 13:44:38 -0400 Subject: [PATCH] ldpctool: Remove VLAs from OffsetMinSumAlgorithm Replace variable length arrays in the int8_t FACTOR specialization of OffsetMinSumAlgorithm::finalp() with a single std::vector scratch buffer. This removes reliance on compiler VLA extensions while preserving the existing contiguous temporary buffer layout. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/ldpctool/generic.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/channelrx/demoddatv/ldpctool/generic.h b/plugins/channelrx/demoddatv/ldpctool/generic.h index 489a36edb..7a6839816 100644 --- a/plugins/channelrx/demoddatv/ldpctool/generic.h +++ b/plugins/channelrx/demoddatv/ldpctool/generic.h @@ -327,12 +327,15 @@ struct OffsetMinSumAlgorithm static void finalp(int8_t *links, int cnt) { int8_t beta = std::nearbyint(0.5 * FACTOR); - int8_t mags[cnt], mins[cnt]; + std::vector scratch(3 * cnt); + int8_t *mags = scratch.data(); + int8_t *mins = mags + cnt; + int8_t *signs = mins + cnt; + for (int i = 0; i < cnt; ++i) mags[i] = subu(sqabs(links[i]), beta); CODE::exclusive_reduce(mags, mins, cnt, min); - int8_t signs[cnt]; CODE::exclusive_reduce(links, signs, cnt, xor_); for (int i = 0; i < cnt; ++i) signs[i] |= 127;