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 2fa610d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Re-use `try_*` functions in `mcountinhibit`

## [v0.12.0] - 2024-10-19

### Added
Expand Down
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 2fa610d

Please sign in to comment.