Skip to content

Commit f476433

Browse files
committed
fix shift
1 parent a70f622 commit f476433

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/peripheral/scb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl SCB {
745745
{
746746
// NOTE(unsafe) atomic read with no side effects
747747
let shpr = unsafe { (*Self::ptr()).shpr[usize::from((index - 8) / 4)].read() };
748-
let prio = (shpr >> (index % 4)) & 0x000000ff;
748+
let prio = (shpr >> (8 * (index % 4))) & 0x000000ff;
749749
prio as u8
750750
}
751751
}
@@ -773,7 +773,7 @@ impl SCB {
773773
#[cfg(armv6m)]
774774
{
775775
self.shpr[usize::from((index - 8) / 4)].modify(|value| {
776-
let shift = index % 4;
776+
let shift = 8 * (index % 4);
777777
let mask = 0x000000ff << shift;
778778
let prio = u32::from(prio) << shift;
779779

0 commit comments

Comments
 (0)