Re: [PATCH v7 16/31] rust: ptr: add const_align_up()

From: Gary Guo

Date: Fri Mar 20 2026 - 09:38:56 EST


On Fri Mar 20, 2026 at 9:48 AM GMT, Alice Ryhl wrote:
> On Tue, Mar 17, 2026 at 11:54 PM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
>>
>> Add const_align_up() to kernel::ptr as the const-compatible equivalent
>> of Alignable::align_up().
>>
>> Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
>> Suggested-by: Gary Guo <gary@xxxxxxxxxxx>
>> Suggested-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
>> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
>
> I think it would be nice to implement the trait versions of this in
> terms of this method, so we only have one implementation.
>
> Alice

The `align_up` is implemented for multiple integer types with macros, so I think
what we have right now is fine.

Best,
Gary