(
raw: RetReg<Num>,
)
| 206 | /// This must only be used with syscalls which return no value on success. |
| 207 | #[inline] |
| 208 | pub(in crate::backend) unsafe fn try_decode_void<Num: RetNumber>( |
| 209 | raw: RetReg<Num>, |
| 210 | ) -> io::Result<()> { |
| 211 | // Instead of using `check_result` here, we just check for zero, since this |
| 212 | // function is only used for system calls which have no other return value, |
| 213 | // and this produces smaller code. |
| 214 | if raw.is_nonzero() { |
| 215 | debug_assert!(raw.is_in_range(-4095..0)); |
| 216 | |
| 217 | // Tell the optimizer that we know the value is in the error range. |
| 218 | // This helps it avoid unnecessary integer conversions. |
| 219 | #[cfg(core_intrinsics)] |
| 220 | { |
| 221 | core::intrinsics::assume(raw.is_in_range(-4095..0)); |
| 222 | } |
| 223 | |
| 224 | return Err(Errno(raw.decode_error_code())); |
| 225 | } |
| 226 | |
| 227 | raw.decode_void(); |
| 228 | |
| 229 | Ok(()) |
| 230 | } |
| 231 | |
| 232 | /// Check for an error from the result of a syscall which does not return on |
| 233 | /// success. On success, return the unconsumed `raw` value. |
no test coverage detected