[PATCH v4 1/2] rust: add `Alignment` type

Alice Ryhl aliceryhl at google.com
Fri Aug 22 07:58:58 UTC 2025


On Thu, Aug 21, 2025 at 09:42:17PM +0900, Alexandre Courbot wrote:
> Alignment operations are very common in the kernel. Since they are
> always performed using a power-of-two value, enforcing this invariant
> through a dedicated type leads to fewer bugs and can improve the
> generated code.
> 
> Introduce the `Alignment` type, inspired by the nightly Rust type of the
> same name and providing the same interface, and a new `Alignable` trait
> allowing unsigned integers to be aligned up or down.
> 
> Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>

Reviewed-by: Alice Ryhl <aliceryhl at google.com>


More information about the Nouveau mailing list