diff options
author | 2018-10-26 19:52:53 +0200 | |
---|---|---|
committer | 2018-10-26 19:52:53 +0200 | |
commit | f47643305768c37706ffe3a321138aff8d8fd627 (patch) | |
tree | 7223954af30b9da364e48b5841ab57f655c80977 | |
parent | a70f622e6bead1e9e83cf2a9b5285fe850828a16 (diff) | |
download | cortex-m-f47643305768c37706ffe3a321138aff8d8fd627.tar.gz cortex-m-f47643305768c37706ffe3a321138aff8d8fd627.tar.zst cortex-m-f47643305768c37706ffe3a321138aff8d8fd627.zip |
fix shift
-rw-r--r-- | src/peripheral/scb.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index 5593792..8dca96b 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -745,7 +745,7 @@ impl SCB { { // NOTE(unsafe) atomic read with no side effects let shpr = unsafe { (*Self::ptr()).shpr[usize::from((index - 8) / 4)].read() }; - let prio = (shpr >> (index % 4)) & 0x000000ff; + let prio = (shpr >> (8 * (index % 4))) & 0x000000ff; prio as u8 } } @@ -773,7 +773,7 @@ impl SCB { #[cfg(armv6m)] { self.shpr[usize::from((index - 8) / 4)].modify(|value| { - let shift = index % 4; + let shift = 8 * (index % 4); let mask = 0x000000ff << shift; let prio = u32::from(prio) << shift; |