summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-09-12 03:36:55 +0000
committerGitHub <noreply@github.com>2021-09-12 03:36:55 +0000
commitf44a50685773f44e88e31b83a3d49d278132a21c (patch)
tree14ce9b7f16288162f6ba6375d3dac131fbc70482
parentccc1434960740dd0cb54e8141a22dd2ae920b956 (diff)
parent369bd8ef3a31ce3a324ee9b993ea312968707197 (diff)
downloadnix-f44a50685773f44e88e31b83a3d49d278132a21c.zip
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 <linkmauve@linkmauve.fr>
-rw-r--r--src/errno.rs1
1 files changed, 1 insertions, 0 deletions
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<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> {
if value == S::sentinel() {
Err(Self::last())