conf: fix snd_func_imul accumulator initialization#511
Open
orange-dot wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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