Re: [PATCH 03/12] rust: num: add Bounded::shr_exact
"Alexandre Courbot" <[email protected]>
| Newsgroups | org.freedesktop.lists.dri-devel,dev.linux.lists.driver-core,dev.linux.lists.nova-gpu,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Wed Aug 5, 2026 at 2:44 PM JST, Eliot Courtney wrote: > Add `shr_exact` in the vein of `try_shrink` which shifts a bounded right > only if it loses no set bits. This is useful for getting a shifted down > integer while simultaneously checking that it's aligned. > > Signed-off-by: Eliot Courtney <[email protected]> Maybe it is worth briefly mentioning that an equivalent method exists in the standard library (in nightly) for primitive types [1]. With the missing `#[inline]` mentioned by Sashiko fixed, Acked-by: Alexandre Courbot <[email protected]> [1] https://doc.rust-lang.org/std/primitive.u32.html#method.shr_exact