Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/serde_json/src/lexical/digit.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / serde_json / src / lexical / digit.rs` 18 lines ยท 444 bytes Raw Blame History 1 // Adapted from https://github.com/Alexhuszagh/rust-lexical. 2 3 //! Helpers to convert and add digits from characters. 4 5 // Convert u8 to digit. 6 #[inline] 7 pub(crate) fn to_digit(c: u8) -> Option { 8 (c as char).to_digit(10) 9 } 10 11 // Add digit to mantissa. 12 #[inline] 13 pub(crate) fn add_digit(value: u64, digit: u32) -> Option { 14 match value.checked_mul(10) { 15 None => None, 16 Some(n) => n.checked_add(digit as u64), 17 } 18 }