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/itoa/src/u128_ext.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 / itoa / src / u128_ext.rs` 22 lines ยท 695 bytes Raw Blame History 1 #[cfg(feature = "no-panic")] 2 use no_panic::no_panic; 3 4 /// Multiply unsigned 128 bit integers, return upper 128 bits of the result 5 #[inline] 6 #[cfg_attr(feature = "no-panic", no_panic)] 7 pub(crate) fn mulhi(x: u128, y: u128) -> u128 { 8 let x_lo = x as u64; 9 let x_hi = (x >> 64) as u64; 10 let y_lo = y as u64; 11 let y_hi = (y >> 64) as u64; 12 13 // handle possibility of overflow 14 let carry = (u128::from(x_lo) * u128::from(y_lo)) >> 64; 15 let m = u128::from(x_lo) * u128::from(y_hi) + carry; 16 let high1 = m >> 64; 17 18 let m_lo = m as u64; 19 let high2 = (u128::from(x_hi) * u128::from(y_lo) + u128::from(m_lo)) >> 64; 20 21 u128::from(x_hi) * u128::from(y_hi) + high1 + high2 22 }