LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Phil Pokorny <ppokorny@penguincomputing.com>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
lm-sensors <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH 1/4] kernel.h: add find_closest() macro
Date: Tue, 24 Feb 2015 12:33:06 -0800 [thread overview]
Message-ID: <CAAek22F3JzWRVqwf=QdaoowjTSkfHAiUP6orpHpcdt_gicaT=A@mail.gmail.com> (raw)
In-Reply-To: <1424799734-2170-2-git-send-email-bgolaszewski@baylibre.com>
On Tue, Feb 24, 2015 at 9:42 AM, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> Searching for the member of an array closest to 'x' is
> duplicated in several places.
>
> Add two macros that implement this algorithm for arrays
> sorted both in ascending and descending order.
I don't see the point here. You're not saving any code because your
macros create functions at each invocation site. And your macro is
more complicated than the code it replaces because it has all the
syntactic cruft to make it adaptable to the different datatypes and
sort orders.
Certainly it is easy to make an off by one mistake in a loop like this
so there might be some small value there, but I'm not sure the
complication is worth that savings for the small number of use points.
Particularly because you're not saving any code.
--
Philip Pokorny, RHCE
Chief Technology Officer
PENGUIN COMPUTING, Inc
www.penguincomputing.com
Changing the world through technical innovation
next prev parent reply other threads:[~2015-02-24 20:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 17:42 [PATCH 0/4] " Bartosz Golaszewski
2015-02-24 17:42 ` [PATCH 1/4] kernel.h: add " Bartosz Golaszewski
2015-02-24 20:33 ` Phil Pokorny [this message]
2015-02-24 20:51 ` [lm-sensors] " Guenter Roeck
2015-02-25 10:59 ` Bartosz Golaszewski
2015-02-26 0:13 ` Guenter Roeck
2015-02-24 17:42 ` [PATCH 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest() Bartosz Golaszewski
2015-02-24 17:42 ` [PATCH 4/4] hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg() Bartosz Golaszewski
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='CAAek22F3JzWRVqwf=QdaoowjTSkfHAiUP6orpHpcdt_gicaT=A@mail.gmail.com' \
--to=ppokorny@penguincomputing.com \
--cc=bgolaszewski@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--subject='Re: [lm-sensors] [PATCH 1/4] kernel.h: add find_closest() macro' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).