ruint/algorithms/
ops.rs

1use super::DoubleWord;
2
3#[inline(always)]
4#[must_use]
5pub fn adc(lhs: u64, rhs: u64, carry: u64) -> (u64, u64) {
6    let result = u128::from(lhs) + u128::from(rhs) + u128::from(carry);
7    result.split()
8}
9
10#[inline(always)]
11#[must_use]
12pub fn sbb(lhs: u64, rhs: u64, borrow: u64) -> (u64, u64) {
13    let result = u128::from(lhs)
14        .wrapping_sub(u128::from(rhs))
15        .wrapping_sub(u128::from(borrow));
16    (result.low(), result.high().wrapping_neg())
17}