Skip to content

Commit

Permalink
riscv: re-use mcountinhibit try_* functions
Browse files Browse the repository at this point in the history
Re-uses the `try_*` functions in their panicking equivalents for a
slight code-size reduction.
  • Loading branch information
rmsyn committed Oct 20, 2024
1 parent f73533a commit 32eb437
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions riscv/src/register/mcountinhibit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ set_clear_csr!(

#[inline]
pub unsafe fn set_hpm(index: usize) {
assert!((3..32).contains(&index));
_set(1 << index);
try_set_hpm(index).unwrap();
}

#[inline]
Expand All @@ -60,8 +59,7 @@ pub unsafe fn try_set_hpm(index: usize) -> Result<()> {

#[inline]
pub unsafe fn clear_hpm(index: usize) {
assert!((3..32).contains(&index));
_clear(1 << index);
try_clear_hpm(index).unwrap();
}

#[inline]
Expand Down

0 comments on commit 32eb437

Please sign in to comment.