Files
linux/rust/kernel
Alexandre Courbot ea60cea07d rust: add Alignment type
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.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
[ Used `build_assert!`, added intra-doc link, `allow`ed
  `clippy::incompatible_msrv`, added `feature(const_option)`, capitalized
  safety comment. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-09-22 23:55:41 +02:00
..
2025-08-27 22:45:41 -07:00
2025-07-23 02:05:58 +02:00
2025-08-24 15:30:40 +02:00
2025-07-23 02:05:58 +02:00
2025-08-13 17:40:28 +02:00
2025-07-21 01:16:35 +02:00
2025-09-22 23:55:41 +02:00
2024-10-08 15:44:36 +02:00
2025-07-21 01:16:35 +02:00
2025-09-22 23:55:41 +02:00
2024-11-04 16:21:44 -05:00