build(ariadne): vendor serde crates
This commit was merged in pull request #15.
This commit is contained in:
1 parent
90f46026f0
commit
64773e0948
490 files changed
+175103
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
#[cfg(feature = "no-panic")]
|
||||
use no_panic::no_panic;
|
||||
|
||||
/// Multiply unsigned 128 bit integers, return upper 128 bits of the result
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "no-panic", no_panic)]
|
||||
pub(crate) fn mulhi(x: u128, y: u128) -> u128 {
|
||||
let x_lo = x as u64;
|
||||
let x_hi = (x >> 64) as u64;
|
||||
let y_lo = y as u64;
|
||||
let y_hi = (y >> 64) as u64;
|
||||
|
||||
// handle possibility of overflow
|
||||
let carry = (u128::from(x_lo) * u128::from(y_lo)) >> 64;
|
||||
let m = u128::from(x_lo) * u128::from(y_hi) + carry;
|
||||
let high1 = m >> 64;
|
||||
|
||||
let m_lo = m as u64;
|
||||
let high2 = (u128::from(x_hi) * u128::from(y_lo) + u128::from(m_lo)) >> 64;
|
||||
|
||||
u128::from(x_hi) * u128::from(y_hi) + high1 + high2
|
||||
}
|
||||
Reference in new issue
Block a user