Re: [PATCH v6 2/2] iio: frequency: ad9832: simplify bitwise math
From: Joshua Crofts
Date: Sun Apr 19 2026 - 13:21:05 EST
On Sun, 19 Apr 2026 at 18:52, Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> > - unsigned long long freqreg = (u64)fout *
> > - (u64)((u64)1L << AD9832_FREQ_BITS);
> > + u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS);
> https://sashiko.dev/#/patchset/20260417101623.1281-1-joshua.crofts1%40gmail.com
>
> So does this actually improve readability? Sashiko had fun with this one and
> I'm somewhat inclined to agree with it. The suggestion it made was that
> the following was more readable still and avoided oddity of using BIT_ULL as
> a multiplier.
>
> u64 freqreg = (u64)fout << AD9832_FREQ_BITS;
Fair enough, the suggestion seems valid. IMO my initial patch did improve the
readability as it removed two u64 casts in the expression, but sure, I'll send a
follow up patch.
Thanks for the reviews on the other patches, these are my first ever ones
that I've submitted.
--
Kind regards
CJD