MCPcopy Index your code
hub / github.com/RustPython/RustPython / dump_decimal

Function dump_decimal

crates/stdlib/src/faulthandler.rs:175–202  ·  view source on GitHub ↗
(fd: i32, value: usize)

Source from the content-addressed store, hash-verified

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)]

Callers 3

dump_frame_from_rawFunction · 0.85
dump_frame_from_refFunction · 0.85
faulthandler_fatal_errorFunction · 0.85

Calls 4

putsFunction · 0.85
writeFunction · 0.50
lenMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected