pub struct Invariant {
pub value: Option<Value>,
pub scale: i128,
pub offset: i128,
}Expand description
A value that does not change inside the loop, read as scale * value + offset.
The value is a value defined outside the loop, or None when the expression is a plain
number. Keeping the shape rather than a bare Value is what lets j = 2 * i + 3 come out
as {3, +, 2} instead of unknown: the base and the step of that chrec are expressions nothing
in the function computes, so a representation that could only name existing values would have
to give up.
Arithmetic on two of these is refused when both are symbolic and the symbols differ, because
x + y is not of this shape. That is the boundary of the subset and it is where the answer
becomes unknown rather than wrong.
Fields§
§value: Option<Value>What it is built on, or None for a plain number.
scale: i128How many of it.
offset: i128What is added to it.
Implementations§
Trait Implementations§
impl Copy for Invariant
impl Eq for Invariant
impl StructuralPartialEq for Invariant
Auto Trait Implementations§
impl Freeze for Invariant
impl RefUnwindSafe for Invariant
impl Send for Invariant
impl Sync for Invariant
impl Unpin for Invariant
impl UnsafeUnpin for Invariant
impl UnwindSafe for Invariant
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more