Skip to content

Commit 28faaf8

Browse files
committed
zephyr: error: Always inline error wrappers
Setting these to always inline has a rather noticeable impact on performance of most calls to Zephyr, at the cost of a bit more code space. Signed-off-by: David Brown <[email protected]>
1 parent ac63f35 commit 28faaf8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

zephyr/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub type Result<T> = core::result::Result<T, Error>;
4242
/// Map a return result from Zephyr into an Result.
4343
///
4444
/// Negative return results being considered errors.
45+
#[inline(always)]
4546
pub fn to_result(code: c_int) -> Result<c_int> {
4647
if code < 0 {
4748
Err(Error(-code as u32))
@@ -51,6 +52,7 @@ pub fn to_result(code: c_int) -> Result<c_int> {
5152
}
5253

5354
/// Map a return result, with a void result.
55+
#[inline(always)]
5456
pub fn to_result_void(code: c_int) -> Result<()> {
5557
to_result(code).map(|_| ())
5658
}

0 commit comments

Comments
 (0)