[PATCH v5 05/23] rust: num: add the `fls` operation
Miguel Ojeda
miguel.ojeda.sandonis at gmail.com
Sun Jun 15 13:25:42 UTC 2025
On Sun, Jun 15, 2025 at 12:58 PM Alexandre Courbot <acourbot at nvidia.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.
Cheers,
Miguel
More information about the dri-devel
mailing list