From: Thorsten Blum <thorsten.blum@linux.dev>
To: Takashi Iwai <tiwai@suse.de>
Cc: "Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: mips/hal2: Refactor and improve hal2_compute_rate()
Date: Tue, 1 Jul 2025 12:18:44 +0200 [thread overview]
Message-ID: <64167092-D0B5-4E78-AC07-62733EEEAD65@linux.dev> (raw)
In-Reply-To: <87wm8sclf8.wl-tiwai@suse.de>
On 1. Jul 2025, at 11:25, Takashi Iwai wrote:
> IMHO, this doesn't look improving the code readability than the
> original code. And the generated code doesn't seem significantly
> better, either.
I didn't look at the generated code, but I think the patch definitely
improves the function (not necessarily its runtime, but its readability
and maintainability).
I think the patch primarily improves maintainability by eliminating the
magic number '4' that was scattered throughout the function. Now the
scaling factor is assigned once to the semantically more meaningful
variable 'codec->inc' and used consistently.
It also improves consistency by using 'codec->master' when calculating
'codec->mod' instead of repeating the constants '44100' and '48000'.
Additionally, it removes the unnecessary local variable 'mod' and the
'rate' update, making the function more concise (4 vs 12 lines).
Thanks,
Thorsten
next prev parent reply other threads:[~2025-07-01 10:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 21:45 [PATCH] ALSA: mips/hal2: Refactor and improve hal2_compute_rate() Thorsten Blum
2025-07-01 9:25 ` Takashi Iwai
2025-07-01 10:18 ` Thorsten Blum [this message]
2025-07-01 11:49 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64167092-D0B5-4E78-AC07-62733EEEAD65@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.