Skip to content

conf: fix snd_func_imul accumulator initialization#511

Open
orange-dot wants to merge 1 commit into
alsa-project:masterfrom
orange-dot:fix-snd-config-imul
Open

conf: fix snd_func_imul accumulator initialization#511
orange-dot wants to merge 1 commit into
alsa-project:masterfrom
orange-dot:fix-snd-config-imul

Conversation

@orange-dot

Copy link
Copy Markdown

snd_func_iops() initialized result to 0 for both iadd and imul. For
imul, every multiplication step therefore multiplied by 0, so @func imul
always evaluated to 0.

Initialize the accumulator to 1 for imul, while preserving the existing
0 result for an empty integers list. Add regression coverage for iadd and
imul evaluation.

Fixes: #456

snd_func_iops() initialized result to 0 for both iadd and imul. For
imul this made every multiplication step multiply by 0, so
snd_func_imul() returned 0 for every input since it was added in
aa7a0dd (2006-10-11). The doxygen example for imul therefore did not
match observed behavior.

Initialize the accumulator to 1 for imul and keep the empty integers
list result as 0. Add table-driven config tests covering iadd and imul
single, multi, zero, negative, empty, and out-of-order integer lists.

Fixes: alsa-project#456

Signed-off-by: Bojan Janjatovic <bojan.janjatovic@mamut-studio.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

snd_config_imul always produces a zero result.

1 participant