trait OverflowingOp: Sized {
const ONE_PASS: bool = true;
// Required methods
fn add_overflowing(self, rhs: Self) -> (Self, bool);
fn sub_overflowing(self, rhs: Self) -> (Self, bool);
fn mul_overflowing(self, rhs: Self) -> (Self, bool);
}Expand description
Wrapping +, - and * that also report whether they overflowed, written
so that LLVM vectorizes a loop over them.
The signed overflowing_add and overflowing_sub lower to
llvm.sadd.with.overflow and llvm.ssub.with.overflow, which LLVM doesn’t
vectorize, so the signed impls test the sign bits instead.
Provided Associated Constants§
Sourceconst ONE_PASS: bool = true
const ONE_PASS: bool = true
Whether the checked kernels use the one-pass path for this type. When
it’s false, overflowing_op returns None without doing any work.
Required Methods§
fn add_overflowing(self, rhs: Self) -> (Self, bool)
fn sub_overflowing(self, rhs: Self) -> (Self, bool)
fn mul_overflowing(self, rhs: Self) -> (Self, bool)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".