Skip to content

Commit c3dba12

Browse files
committed
Update unsafe comments
1 parent 536575c commit c3dba12

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/peripheral/scb.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,7 @@ impl SCB {
950950
{
951951
// NOTE(unsafe) atomic read with no side effects
952952

953-
// NOTE(unsafe): prevent unnecessary bounds check! Index of shpr array is
954-
// true by SystemHandler design.
953+
// NOTE(unsafe): Index is bounded to [4,15] by SystemHandler design.
955954
let priority_ref = unsafe {(*Self::ptr()).shpr.get_unchecked(usize::from(index - 4))};
956955

957956
priority_ref.read()
@@ -961,8 +960,7 @@ impl SCB {
961960
{
962961
// NOTE(unsafe) atomic read with no side effects
963962

964-
// NOTE(unsafe): prevent unnecessary bounds check! Index of shpr array is
965-
// true by SystemHandler design.
963+
// NOTE(unsafe): Index is bounded to [11,15] by SystemHandler design.
966964
let priority_ref = unsafe {(*Self::ptr()).shpr.get_unchecked(usize::from((index - 8) / 4))};
967965

968966
let shpr = priority_ref.read();
@@ -989,17 +987,15 @@ impl SCB {
989987

990988
#[cfg(not(armv6m))]
991989
{
992-
// NOTE(unsafe): prevent unnecessary bounds check! Index of shpr array is
993-
// true by SystemHandler design.
990+
// NOTE(unsafe): Index is bounded to [4,15] by SystemHandler design.
994991
let priority_ref = (*Self::ptr()).shpr.get_unchecked(usize::from(index - 4));
995992

996993
priority_ref.write(prio)
997994
}
998995

999996
#[cfg(armv6m)]
1000997
{
1001-
// NOTE(unsafe): prevent unnecessary bounds check! Index of shpr array is
1002-
// true by SystemHandler design.
998+
// NOTE(unsafe): Index is bounded to [11,15] by SystemHandler design.
1003999
let priority_ref = (*Self::ptr()).shpr.get_unchecked(usize::from((index - 8) / 4));
10041000

10051001
priority_ref.modify(|value| {

0 commit comments

Comments
 (0)