Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-07 Thread Alexandre Courbot
On Tue May 6, 2025 at 12:25 AM JST, Joel Fernandes wrote: >> Actually it may be a good idea to move this into its own patch/series so >> it gets more attention as this is starting to look like the `num` or >> `num_integer` crates and we might be well-advised to take more >> inspiration from them in

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-03 Thread Alexandre Courbot
On Sat May 3, 2025 at 12:02 PM JST, Joel Fernandes wrote: > > > On 5/2/2025 9:59 PM, Alexandre Courbot wrote: >>> pub trait AlignUp { >>> fn align_up(self, alignment: Self) -> Self; >>> } >>> >>> macro_rules! align_up_impl { >>> ($($t:ty),+) => { >>> $( >>> impl AlignUp

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-03 Thread Alexandre Courbot
On Sat May 3, 2025 at 12:02 PM JST, Joel Fernandes wrote: > > > On 5/2/2025 9:59 PM, Alexandre Courbot wrote: >>> pub trait AlignUp { >>> fn align_up(self, alignment: Self) -> Self; >>> } >>> >>> macro_rules! align_up_impl { >>> ($($t:ty),+) => { >>> $( >>> impl AlignUp

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-02 Thread Alexandre Courbot
On Sat May 3, 2025 at 4:59 AM JST, Joel Fernandes wrote: > Hello, Alex, > > On 5/2/2025 12:57 AM, Alexandre Courbot wrote: >> On Thu May 1, 2025 at 9:58 PM JST, Alexandre Courbot wrote: >>> From: Joel Fernandes >>> >>> This will be used in the nova-core driver where we need to upward-align >>> the

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
On Thu May 1, 2025 at 9:58 PM JST, Alexandre Courbot wrote: > From: Joel Fernandes > > This will be used in the nova-core driver where we need to upward-align > the image size to get to the next image in the VBIOS ROM. > > [acour...@nvidia.com: handled conflicts due to removal of patch creating >

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
On Fri May 2, 2025 at 12:19 AM JST, Timur Tabi wrote: > On Thu, 2025-05-01 at 21:58 +0900, Alexandre Courbot wrote: > > >> +impl UsizeAlign for usize { >> +    fn align_up(mut self, align: usize) -> usize { >> +    self = (self + align - 1) & !(align - 1); >> +    self >> +    } >> +} >> +

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Timur Tabi
On Thu, 2025-05-01 at 21:58 +0900, Alexandre Courbot wrote: > +impl UsizeAlign for usize { > +    fn align_up(mut self, align: usize) -> usize { > +    self = (self + align - 1) & !(align - 1); > +    self > +    } > +} > + > +/// Aligns `val` upwards to the nearest multiple of `align`. >

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Timur Tabi
On Thu, 2025-05-01 at 11:22 -0400, Joel Fernandes wrote: > Also not mutating it like that matches the pattern in the rest of this file > so > I'd leave it as-is. Oh I see now. One version changes a variable, and the other returns a new value.

[PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
From: Joel Fernandes This will be used in the nova-core driver where we need to upward-align the image size to get to the next image in the VBIOS ROM. [acour...@nvidia.com: handled conflicts due to removal of patch creating num.rs] Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot