From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 591AFC54E65 for ; Thu, 22 May 2025 22:17:11 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C8F0660207; Fri, 23 May 2025 00:16:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8F0660207 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1747952229; bh=sA87XegWlcOXTGFM6ReOF9NSeAnJa2DXtRFZs6ZMnzg=; h=From:To:In-Reply-To:References:Subject:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=rq1Z0aV8TNZ4UYxrhdiCIjNwqYRsGO/0RgmU7SzzOWpqsG5M8u6mVnFx14nO36dx6 Dd7c5O1KvAPCXpABLdSiUCUP3s3zLZMu3GKX+HsSJ6dHYL3Fg/yQzjuS9bIklxi0Yb kJMzihfcWWJsO3/k9lfZXDkbbOZvpUOlGj1SOhF4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC8D7F80630; Fri, 23 May 2025 00:16:00 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C9BA3F8062E; Fri, 23 May 2025 00:16:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F1FC3F805BB; Fri, 23 May 2025 00:15:56 +0200 (CEST) Received: from webhooks-bot.alsa-project.org (vmi2259423.contaboserver.net [45.14.194.44]) by alsa1.perex.cz (Postfix) with ESMTP id A4058F8059F for ; Fri, 23 May 2025 00:15:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A4058F8059F MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: GitHub issues - edited To: alsa-devel@alsa-project.org Message-Id: <1841f939799b2900-webhooks-bot@alsa-project.org> In-Reply-To: <1841f9397998a900-webhooks-bot@alsa-project.org> References: <1841f9397998a900-webhooks-bot@alsa-project.org> Subject: snd_config_imul always produces a zero result. Date: Fri, 23 May 2025 00:15:56 +0200 (CEST) Message-ID-Hash: 43WKPTTHTA3KIPOTPYEEPHSVEPE5IC4R X-Message-ID-Hash: 43WKPTTHTA3KIPOTPYEEPHSVEPE5IC4R X-MailFrom: github@alsa-project.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: alsa-project/alsa-lib issue #456 was edited from shanekirk: The config function snd_config_imul always produces a zero result. This is because it delegates to snd_func_iops() to perform the iterative multiplication, which always initializes its result value to zero. Then it iteratively multiplies-assigns result against each integer in the params array, which _always_ produces zero. This breaks any configuration that leans on "`@func imul`". This can be demonstrated using this snippet of configuration... ``` test_fn { @func imul integers [2 4 6] } ``` ...or this source code... ``` int main(int argc, char **argv) { snd_config_t *pConfig = NULL; snd_config_top(&pConfig); /** * Setting up... * test_fn * { * @func imul * integers [2 4 6] * } */ snd_config_t *pFnCS = NULL; snd_config_make_compound(&pFnCS, "test_fn", 0); snd_config_add(pConfig, pFnCS); snd_config_t *pFn = NULL; snd_config_imake_string(&pFn, "@func", "imul"); snd_config_add(pFnCS, pFn); snd_config_t *pFnParams = NULL; snd_config_make_compound(&pFnParams, "integers", 0); snd_config_add(pFnCS, pFnParams); snd_config_t *pFnInt = NULL; snd_config_imake_integer(&pFnInt, "0", 2); snd_config_add(pFnParams, pFnInt); snd_config_imake_integer(&pFnInt, "1", 4); snd_config_add(pFnParams, pFnInt); snd_config_imake_integer(&pFnInt, "2", 6); snd_config_add(pFnParams, pFnInt); /** * Evaluating... */ snd_config_evaluate(pFnCS, pConfig, NULL, NULL); assert(snd_config_get_type(pFnCS) == SND_CONFIG_TYPE_INTEGER); long result = 0; snd_config_get_integer(pFnCS, &result); assert(result == 48); // ** FAILS because result is always zero! ** snd_config_delete(pConfig); return 0; } ``` Note: If you replace "imul" above with "iadd" in either example, you'll get the result from iadd that you'd expect. Issue URL : https://github.com/alsa-project/alsa-lib/issues/456 Repository URL: https://github.com/alsa-project/alsa-lib