Skip to content

Commit

Permalink
Merge pull request rust-embedded#201 from jasonwhite/jw/mstatus-from-…
Browse files Browse the repository at this point in the history
…bits

Add Mstatus::from(usize)
  • Loading branch information
romancardenas authored Apr 22, 2024
2 parents aca6410 + 288d023 commit 33516b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

- Add `Mcause::from(usize)` for use in unit tests
- Add `Mstatus::from(usize)` for use in unit tests
- Add `Mstatus.bits()`

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions riscv/src/register/mstatus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ pub struct Mstatus {
bits: usize,
}

impl From<usize> for Mstatus {
#[inline]
fn from(bits: usize) -> Self {
Self { bits }
}
}

/// Additional extension state
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum XS {
Expand Down

0 comments on commit 33516b9

Please sign in to comment.