From e3c9926a430ec17396e2c2a44cb862696c437fa1 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 22 Nov 2020 15:08:57 +0200 Subject: [PATCH] [del] tock-registers: Inline more aggressively --- crates/tock-registers/src/registers.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/tock-registers/src/registers.rs b/crates/tock-registers/src/registers.rs index 3664863..f62013a 100644 --- a/crates/tock-registers/src/registers.rs +++ b/crates/tock-registers/src/registers.rs @@ -503,6 +503,7 @@ impl Field { } /// Get the raw bitmask used by this Field. + #[inline] pub fn mask(&self) -> T { (self.mask as T) << self.shift } @@ -580,6 +581,7 @@ FieldValue_impl_for!(u8, u16, u32, u64, u128); impl FieldValue { /// Get the raw bitmask represented by this FieldValue. + #[inline] pub fn mask(&self) -> T { self.mask as T } @@ -590,16 +592,19 @@ impl FieldValue { } /// Modify fields in a register value + #[inline] pub fn modify(self, val: T) -> T { (val & !self.mask) | self.value } /// Check if any specified parts of a field match + #[inline] pub fn matches_any(self, val: T) -> bool { val & self.mask != T::zero() } /// Check if all specified parts of a field match + #[inline] pub fn matches_all(self, val: T) -> bool { val & self.mask == self.value } @@ -608,6 +613,8 @@ impl FieldValue { // Combine two fields with the addition operator impl Add for FieldValue { type Output = Self; + + #[inline] fn add(self, rhs: Self) -> Self { FieldValue { mask: self.mask | rhs.mask, @@ -619,6 +626,7 @@ impl Add for FieldValue { // Combine two fields with the += operator impl AddAssign for FieldValue { + #[inline] fn add_assign(&mut self, rhs: FieldValue) { self.mask |= rhs.mask; self.value |= rhs.value;