From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Alexandre Courbot" <acourbot@nvidia.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Benno Lossin" <lossin@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v7] rust: kernel: add support for bits/genmask macros
Date: Wed, 02 Jul 2025 22:27:24 +0900 [thread overview]
Message-ID: <DB1LRERP8RYU.1FA5867DN8BCZ@nvidia.com> (raw)
In-Reply-To: <DB1LPLOF0O0R.YQBJ0HBDUSKA@nvidia.com>
On Wed Jul 2, 2025 at 10:25 PM JST, Alexandre Courbot wrote:
>> +impl_genmask_fn!(
>> + u64,
>> + /// # Examples
>> + ///
>> + /// ```
>> + /// # use kernel::bits::genmask_u64;
>> + /// let mask = genmask_u64(21..=39);
>> + /// assert_eq!(mask, 0x000000ffffe00000);
>
> I think we should also have 2 examples that show the behavior at the
> limits (i.e. `0..=0` and `0..=63` here ; possibly others if you can see
> interesting cases.). They are useful to understand how the function
> actually works, and would also have caught the errors I pointed out
> above.
Also one last nit: users will count the bits on these examples, so to
make that task easier, please write long hexadecimal values as
`0x0000_00ff_ffe0_0000`. :)
prev parent reply other threads:[~2025-07-02 13:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 20:17 [PATCH v7] rust: kernel: add support for bits/genmask macros Daniel Almeida
2025-07-02 10:27 ` Alice Ryhl
2025-07-02 13:05 ` Daniel Almeida
2025-07-02 13:25 ` Alexandre Courbot
2025-07-02 13:27 ` Alexandre Courbot [this message]
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=DB1LRERP8RYU.1FA5867DN8BCZ@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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