Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/serde_json/src/lexical/   (Fast Lexical Analyzer Version 2.6©)  Datei vom 10.2.2025 mit Größe 444 B image not shown  

Quelle  digit.rs   Sprache: unbekannt

 
// Adapted from https://github.com/Alexhuszagh/rust-lexical.

//! Helpers to convert and add digits from characters.

// Convert u8 to digit.
#[inline]
pub(crate) fn to_digit(c: u8) -> Option<u32> {
    (c as char).to_digit(10)
}

// Add digit to mantissa.
#[inline]
pub(crate) fn add_digit(value: u64, digit: u32) -> Option<u64> {
    match value.checked_mul(10) {
        None => None,
        Some(n) => n.checked_add(digit as u64),
    }
}

[ Dauer der Verarbeitung: 0.20 Sekunden  (vorverarbeitet)  ]