We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93d08ab commit bc3f664Copy full SHA for bc3f664
rust/kernel/bits.rs
@@ -0,0 +1,10 @@
1
+//use crate::static_assert;
2
+
3
+/// Generate a mask where all bits >= `h` and <= `l` are set
4
+///
5
+/// This is a re-implementation in rust of `GENMASK`
6
+pub const fn genmask(h: u32, l: u32) -> u32 {
7
+ //static_assert!(h >= l);
8
+ //static_assert!(h < 32);
9
+ ((!0u32) - (1 << l) + 1) & ((!0u32) >> (32 - 1 - h))
10
+}
rust/kernel/lib.rs
@@ -33,6 +33,7 @@ extern crate self as kernel;
33
#[cfg(not(test))]
34
#[cfg(not(testlib))]
35
mod allocator;
36
+pub mod bits;
37
mod build_assert;
38
pub mod cred;
39
pub mod device;
0 commit comments