Skip to content

Commit f44a506

Browse files
bors[bot]linkmauve
andauthored
Merge #1518
1518: Make Errno::result() inline r=asomers a=linkmauve 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. Co-authored-by: linkmauve <[email protected]>
2 parents ccc1434 + 369bd8e commit f44a506

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)