diff options
author | 2021-02-19 11:59:26 +0000 | |
---|---|---|
committer | 2021-02-19 11:59:26 +0000 | |
commit | e8179ecc6f7590fd014e1d25da1ba708535e5ede (patch) | |
tree | 150a4c9c77289e0c385f3bd84b54661e82262533 | |
parent | 7481f09d67aee7081d71cf6e042f2984c12a830f (diff) | |
parent | e802d0ef23dd10c9d01dda4e04d55f28718ad139 (diff) | |
download | cortex-m-e8179ecc6f7590fd014e1d25da1ba708535e5ede.tar.gz cortex-m-e8179ecc6f7590fd014e1d25da1ba708535e5ede.tar.zst cortex-m-e8179ecc6f7590fd014e1d25da1ba708535e5ede.zip |
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 <i@yvt.jp>
-rw-r--r-- | src/register/primask.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/register/primask.rs b/src/register/primask.rs index 17f7295..842ca49 100644 --- a/src/register/primask.rs +++ b/src/register/primask.rs @@ -26,11 +26,7 @@ impl Primask { /// Reads the CPU register #[inline] pub fn read() -> Primask { - fn read_raw() -> u32 { - call_asm!(__primask_r() -> u32) - } - - let r = read_raw(); + let r: u32 = call_asm!(__primask_r() -> u32); if r & (1 << 0) == (1 << 0) { Primask::Inactive } else { |