Coverage Report

Created: 2026-02-14 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/ryu-1.0.23/src/pretty/mantissa.rs
Line
Count
Source
1
use crate::digit_table::DIGIT_TABLE;
2
use core::ptr;
3
4
#[cfg_attr(feature = "no-panic", inline)]
5
10.3k
pub unsafe fn write_mantissa_long(mut output: u64, mut result: *mut u8) {
6
10.3k
    if (output >> 32) != 0 {
7
4.86k
        // One expensive 64-bit division.
8
4.86k
        let mut output2 = (output - 100_000_000 * (output / 100_000_000)) as u32;
9
4.86k
        output /= 100_000_000;
10
4.86k
11
4.86k
        let c = output2 % 10_000;
12
4.86k
        output2 /= 10_000;
13
4.86k
        let d = output2 % 10_000;
14
4.86k
        let c0 = (c % 100) << 1;
15
4.86k
        let c1 = (c / 100) << 1;
16
4.86k
        let d0 = (d % 100) << 1;
17
4.86k
        let d1 = (d / 100) << 1;
18
4.86k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c0 as isize), result.sub(2), 2);
19
4.86k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c1 as isize), result.sub(4), 2);
20
4.86k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(d0 as isize), result.sub(6), 2);
21
4.86k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(d1 as isize), result.sub(8), 2);
22
4.86k
        result = result.sub(8);
23
5.53k
    }
24
10.3k
    write_mantissa(output as u32, result);
25
10.3k
}
26
27
#[cfg_attr(feature = "no-panic", inline)]
28
10.3k
pub unsafe fn write_mantissa(mut output: u32, mut result: *mut u8) {
29
19.2k
    while output >= 10_000 {
30
8.89k
        let c = output - 10_000 * (output / 10_000);
31
8.89k
        output /= 10_000;
32
8.89k
        let c0 = (c % 100) << 1;
33
8.89k
        let c1 = (c / 100) << 1;
34
8.89k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c0 as isize), result.sub(2), 2);
35
8.89k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c1 as isize), result.sub(4), 2);
36
8.89k
        result = result.sub(4);
37
8.89k
    }
38
10.3k
    if output >= 100 {
39
3.94k
        let c = (output % 100) << 1;
40
3.94k
        output /= 100;
41
3.94k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c as isize), result.sub(2), 2);
42
3.94k
        result = result.sub(2);
43
6.45k
    }
44
10.3k
    if output >= 10 {
45
4.39k
        let c = output << 1;
46
4.39k
        ptr::copy_nonoverlapping(DIGIT_TABLE.as_ptr().offset(c as isize), result.sub(2), 2);
47
6.00k
    } else {
48
6.00k
        *result.sub(1) = b'0' + output as u8;
49
6.00k
    }
50
10.3k
}