[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DANR08O454U7.2VTTLNPOTD6U@nvidia.com>
Date: Mon, 16 Jun 2025 15:36:42 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Danilo Krummrich" <dakr@...nel.org>, "David Airlie" <airlied@...il.com>,
"Simona Vetter" <simona@...ll.ch>, "Maarten Lankhorst"
<maarten.lankhorst@...ux.intel.com>, "Maxime Ripard" <mripard@...nel.org>,
"Thomas Zimmermann" <tzimmermann@...e.de>, "Benno Lossin"
<lossin@...nel.org>, "John Hubbard" <jhubbard@...dia.com>, "Ben Skeggs"
<bskeggs@...dia.com>, "Joel Fernandes" <joelagnelf@...dia.com>, "Timur
Tabi" <ttabi@...dia.com>, "Alistair Popple" <apopple@...dia.com>,
<linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>,
<nouveau@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH v5 05/23] rust: num: add the `fls` operation
On Sun Jun 15, 2025 at 10:25 PM JST, Miguel Ojeda wrote:
> On Sun, Jun 15, 2025 at 12:58 PM Alexandre Courbot <acourbot@...dia.com> wrote:
>>
>> Also, although this will work nicely for `impl_fls!` which is a single
>> function, I'm afraid this won't scale well for `power_of_two_impl!`,
>> which defines 6 functions per type... Any suggestions for this case?
>
> We can always generate the same "cases", i.e. sharing as much as
> possible the lines, and just passing the values (numbers) that
> actually differ, which you then plug into the example line
> concatenating.
>
> The standard library does that for their integer macros, e.g.
>
> https://doc.rust-lang.org/src/core/num/int_macros.rs.html#3639-3644
>
> If that happened to be too onerous for some reason, then we could
> ignore it for the time being (i.e. we don't need to delay things just
> for that), or we could put them as `#[test]`s to at least have them as
> tests.
Thanks, this appears to work quite nicely (if a bit verbose), and I can
adjust the tests to avoid the need to take extra arguments.
Powered by blists - more mailing lists