(fd: i32, value: usize)
| 173 | // _Py_DumpDecimal (traceback.c) |
| 174 | #[cfg(any(unix, windows))] |
| 175 | fn dump_decimal(fd: i32, value: usize) { |
| 176 | let mut buf = [0u8; 20]; |
| 177 | let mut v = value; |
| 178 | let mut i = buf.len(); |
| 179 | |
| 180 | if v == 0 { |
| 181 | puts(fd, "0"); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | while v > 0 { |
| 186 | i -= 1; |
| 187 | buf[i] = b'0' + (v % 10) as u8; |
| 188 | v /= 10; |
| 189 | } |
| 190 | |
| 191 | let len = buf.len() - i; |
| 192 | let _ = unsafe { |
| 193 | #[cfg(windows)] |
| 194 | { |
| 195 | libc::write(fd, buf[i..].as_ptr() as *const libc::c_void, len as u32) |
| 196 | } |
| 197 | #[cfg(not(windows))] |
| 198 | { |
| 199 | libc::write(fd, buf[i..].as_ptr() as *const libc::c_void, len) |
| 200 | } |
| 201 | }; |
| 202 | } |
| 203 | |
| 204 | /// Get current thread ID |
| 205 | #[cfg(unix)] |
no test coverage detected