Skip to content

Commit 369bd8e

Browse files
authored
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.
1 parent ccc1434 commit 369bd8e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/errno.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ impl Errno {
103103

104104
/// Returns `Ok(value)` if it does not contain the sentinel value. This
105105
/// should not be used when `-1` is not the errno sentinel value.
106+
#[inline]
106107
pub fn result<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> {
107108
if value == S::sentinel() {
108109
Err(Self::last())

0 commit comments

Comments
 (0)