Skip to content

Commit e8179ec

Browse files
bors[bot]yvt
andauthored
Merge #334
334: Remove an extra function call in `primask::read` r=jonas-schievink a=yvt There doesn't seem to be any reason why the call to `__primask_r` should be wrapped by another function call. `read_raw` (the function being removed by this PR) is not `#[inline]`, so it did hurt performance when compiled without LTO. Compare with `faultmask::read`: https://github.com/rust-embedded/cortex-m/blob/7481f09d67aee7081d71cf6e042f2984c12a830f/src/register/faultmask.rs#L26-L35 Co-authored-by: yvt <[email protected]>
2 parents 7481f09 + e802d0e commit e8179ec

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/register/primask.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ impl Primask {
2626
/// Reads the CPU register
2727
#[inline]
2828
pub fn read() -> Primask {
29-
fn read_raw() -> u32 {
30-
call_asm!(__primask_r() -> u32)
31-
}
32-
33-
let r = read_raw();
29+
let r: u32 = call_asm!(__primask_r() -> u32);
3430
if r & (1 << 0) == (1 << 0) {
3531
Primask::Inactive
3632
} else {

0 commit comments

Comments
 (0)