View all comments
Feature gate: #![feature(signed_bigint_helpers)]
This issue continues discussion #85532 with the following methods on integers:
uN::carrying_mul_add_signed
iN::overflowing_add_carry
iN::overflowing_sub_borrow
iN::carrying_mul
iN::carrying_mul_add
iN::carrying_mul_add_unsigned
impl uN {
/// `add += self * rhs + carry`, covers full `i2N` range exactly
fn carrying_mul_add_signed(self, rhs: iN, carry: Self, add: iN) -> (Self, iN);
}
impl iN {
/// Returns `self + rhs + carry` and (signed) overflow flag;
/// should be used for most significant limb only; shouldn't be chained
fn overflowing_add_carry(self, rhs: Self, carry: bool) -> (Self, bool);
/// Returns `self - rhs - borrow` and (signed) overflow flag;
/// should be used for most significant limb only; shouldn't be chained
fn overflowing_sub_borrow(self, rhs: Self, borrow: bool) -> (Self, bool);
/// `self * rhs + carry`
fn carrying_mul(self, rhs: Self, carry: Self) -> (uN, Self);
/// `add += self * rhs + carry`, fits `i2N` range, but doesn't cover it fully
fn carrying_mul_add(self, rhs: Self, carry: Self, add: Self) -> (uN, Self);
/// `add += self * rhs + carry`, covers full `i2N` range exactly
fn carrying_mul_add_unsigned(self, rhs: uN, carry: Self, add: uN) -> (uN, Self);
}
View all comments
Feature gate:
#![feature(signed_bigint_helpers)]This issue continues discussion #85532 with the following methods on integers:
uN::carrying_mul_add_signediN::overflowing_add_carryiN::overflowing_sub_borrowiN::carrying_muliN::carrying_mul_addiN::carrying_mul_add_unsigned