From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Joshua Crofts <joshua.crofts1@gmail.com>,
lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
gregkh@linuxfoundation.org, dlechner@baylibre.com,
nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: frequency: ad9832: simplify bitwise math
Date: Tue, 14 Apr 2026 19:59:20 +0300 [thread overview]
Message-ID: <ad5yaDeXhqn7KLmy@ashevche-desk.local> (raw)
In-Reply-To: <ad465p5LVaSMlTUa@stanley.mountain>
On Tue, Apr 14, 2026 at 04:02:30PM +0300, Dan Carpenter wrote:
> On Tue, Apr 14, 2026 at 03:33:52PM +0300, Andy Shevchenko wrote:
> > On Tue, Apr 14, 2026 at 12:45:31PM +0200, Joshua Crofts wrote:
> > > On Tue, 14 Apr 2026 at 11:57, Andy Shevchenko
> > > <andriy.shevchenko@intel.com> wrote:
> > > > It's up to you. (u64) casting here is not bad per se. And it's more robust
> > > > against changes in the second operand the type of which is hidden currently.
> > > > (Reading again what I just wrote, it seems I objecting my own suggestion!)
> >
> > > If I'm not mistaken, the compiler would always do a type promotion of the
> > > "smaller" operand (in this case fout). By casting at this point we're just doing
> > > the work for it, so I guess it doesn't matter.
> >
> > Yes, and the problem here that BIT_ULL() is (semi)hidden on what it returns for
> > smaller values.
>
> There is no way we'd implement a BIT_ULL() that doesn't give you a ULL.
I meant that it's not crystal clear, one needs to know the naming convention of
BIT_ULL() and/or check the implementation. Reading (u64) is much clearer in
that sense. Also in case of BIT_ULL() parameter being < 32 it may be replaced
with BIT().
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-14 16:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-11 12:35 [PATCH v3 0/2] iio: frequency: ad9832: cleanups Joshua Crofts
2026-04-11 12:35 ` [PATCH v3 1/2] iio: frequency: ad9832: remove kernel.h proxy header Joshua Crofts
2026-04-14 9:38 ` Andy Shevchenko
2026-04-14 10:12 ` Joshua Crofts
2026-04-14 11:43 ` Andy Shevchenko
2026-04-14 13:27 ` Joshua Crofts
2026-04-14 17:03 ` Andy Shevchenko
2026-04-15 7:18 ` Joshua Crofts
2026-04-11 12:35 ` [PATCH v3 2/2] iio: frequency: ad9832: simplify bitwise math Joshua Crofts
2026-04-14 9:44 ` Andy Shevchenko
2026-04-14 9:51 ` Joshua Crofts
2026-04-14 9:57 ` Andy Shevchenko
2026-04-14 10:45 ` Joshua Crofts
2026-04-14 12:33 ` Andy Shevchenko
2026-04-14 13:02 ` Dan Carpenter
2026-04-14 16:59 ` Andy Shevchenko [this message]
2026-04-13 7:05 ` [PATCH v3 0/2] iio: frequency: ad9832: cleanups Joshua Crofts
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=ad5yaDeXhqn7KLmy@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox