(
raw: RetReg<Num>,
)
| 177 | /// success. |
| 178 | #[inline] |
| 179 | pub(in crate::backend) unsafe fn try_decode_raw_fd<Num: RetNumber>( |
| 180 | raw: RetReg<Num>, |
| 181 | ) -> io::Result<RawFd> { |
| 182 | // Instead of using `check_result` here, we just check for negative, since |
| 183 | // this function is only used for system calls which return file |
| 184 | // descriptors, and this produces smaller code. |
| 185 | if raw.is_negative() { |
| 186 | debug_assert!(raw.is_in_range(-4095..0)); |
| 187 | |
| 188 | // Tell the optimizer that we know the value is in the error range. |
| 189 | // This helps it avoid unnecessary integer conversions. |
| 190 | #[cfg(core_intrinsics)] |
| 191 | { |
| 192 | core::intrinsics::assume(raw.is_in_range(-4095..0)); |
| 193 | } |
| 194 | |
| 195 | return Err(Errno(raw.decode_error_code())); |
| 196 | } |
| 197 | |
| 198 | Ok(raw.decode_raw_fd()) |
| 199 | } |
| 200 | |
| 201 | /// Check for an error from the result of a syscall which encodes no value on |
| 202 | /// success. On success, return the unconsumed `raw` value. |
no test coverage detected