From 369bd8ef3a31ce3a324ee9b993ea312968707197 Mon Sep 17 00:00:00 2001 From: linkmauve Date: Wed, 8 Sep 2021 21:29:40 +0200 Subject: Make Errno::result() inline This makes the success case a single `cmpl $-1, %eax` followed with a non-taken conditional jump, instead of the current `callq` which is always taken. I have not benchmarked the difference, but it is an obvious improvement. --- src/errno.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/errno.rs b/src/errno.rs index 8e3a924b..2be3179c 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -103,6 +103,7 @@ impl Errno { /// Returns `Ok(value)` if it does not contain the sentinel value. This /// should not be used when `-1` is not the errno sentinel value. + #[inline] pub fn result>(value: S) -> Result { if value == S::sentinel() { Err(Self::last()) -- cgit v1.2.3