Skip to content

Commit 33516b9

Browse files
Merge pull request #201 from jasonwhite/jw/mstatus-from-bits
Add Mstatus::from(usize)
2 parents aca6410 + 288d023 commit 33516b9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

riscv/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Added
1111

1212
- Add `Mcause::from(usize)` for use in unit tests
13+
- Add `Mstatus::from(usize)` for use in unit tests
1314
- Add `Mstatus.bits()`
1415

1516
### Fixed

riscv/src/register/mstatus.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ pub struct Mstatus {
88
bits: usize,
99
}
1010

11+
impl From<usize> for Mstatus {
12+
#[inline]
13+
fn from(bits: usize) -> Self {
14+
Self { bits }
15+
}
16+
}
17+
1118
/// Additional extension state
1219
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
1320
pub enum XS {

0 commit comments

Comments
 (0)