diff options
author | 2020-05-28 00:30:19 +0200 | |
---|---|---|
committer | 2020-05-28 00:30:19 +0200 | |
commit | 513ffd47e65f4e250eb099da4660d474cd4dac29 (patch) | |
tree | 198677a2f90b9e50e5beb21af52072b6aac80aeb /src | |
parent | 53b79bd8bbf449262520f78e4a575af10bebdc69 (diff) | |
download | cortex-m-513ffd47e65f4e250eb099da4660d474cd4dac29.tar.gz cortex-m-513ffd47e65f4e250eb099da4660d474cd4dac29.tar.zst cortex-m-513ffd47e65f4e250eb099da4660d474cd4dac29.zip |
Fix remaining compiler sadness
Diffstat (limited to 'src')
-rw-r--r-- | src/register/fpscr.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/register/fpscr.rs b/src/register/fpscr.rs index d7ceea2..057b145 100644 --- a/src/register/fpscr.rs +++ b/src/register/fpscr.rs @@ -10,9 +10,13 @@ pub struct Fpscr { /// Rounding mode #[derive(Clone, Copy, Debug)] pub enum RMode { + /// Round to Nearest (RN) mode. This is the reset value. Nearest, + /// Round towards Plus Infinity (RP) mode. PlusInfinity, + /// Round towards Minus Infinity (RM) mode. MinusInfinity, + /// Round towards Zero (RZ) mode. Zero, } @@ -68,11 +72,11 @@ impl Fpscr { /// Read the Rounding Mode control field #[inline] pub fn rmode(self) -> RMode { - match self.bits & (3 << 22) { - 0 << 22 => RMode::Nearest, - 1 << 22 => RMode::PlusInfinity, - 2 << 22 => RMode::MinusInfinity, - 3 << 22 => RMode::Zero, + match (self.bits & (3 << 22)) >> 22 { + 0 => RMode::Nearest, + 1 => RMode::PlusInfinity, + 2 => RMode::MinusInfinity, + _ => RMode::Zero, } } |