1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-28 13:04:17 -04:00

demoddatv: Replace OffsetMinSumAlgorithm VLAs with std::vector

Replace the runtime-sized temporary arrays in
OffsetMinSumAlgorithm::finalp() with std::vector.

The array sizes depend on the runtime value of cnt, requiring compiler
support for variable length arrays. Using std::vector removes this
non-standard extension while preserving the existing algorithm and memory
layout.

This eliminates ~24 of remaining -Wvla warnings (for me) reported
from ldpctool/algorithms.h.

Part of #2830

Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
Robin Getz
2026-07-25 16:18:25 -04:00
parent 463daf7eed
commit a10746a22a
@@ -191,12 +191,13 @@ struct OffsetMinSumAlgorithm<SIMD<VALUE, WIDTH>, UPDATE, FACTOR>
static void finalp(TYPE *links, int cnt)
{
TYPE beta = vdup<TYPE>(0.5 * FACTOR);
TYPE mags[cnt], mins[cnt];
std::vector<TYPE> mags(cnt);
std::vector<TYPE> mins(cnt);
for (int i = 0; i < cnt; ++i)
mags[i] = vmax(vsub(vabs(links[i]), beta), vzero<TYPE>());
CODE::exclusive_reduce(mags, mins, cnt, min);
TYPE signs[cnt];
std::vector<TYPE> signs(cnt);
CODE::exclusive_reduce(links, signs, cnt, sign);
for (int i = 0; i < cnt; ++i)