pub struct ShiftedValueIndex {
pub value_index: ValueIndex,
pub shift_variant: ShiftVariant,
pub amount: usize,
}
Expand description
Similar to ValueIndex
, but represents a value that has been shifted by a certain amount.
This is used in the operands to constraints like AndConstraint
.
The canonical formto represent a value without any shifting is ShiftVariant::Sll
with
amount equals 0.
Fields§
§value_index: ValueIndex
The index of this value in the input values vector.
shift_variant: ShiftVariant
The flavour of the shift that the value must be shifted by.
amount: usize
The number of bits by which the value must be shifted by.
Must be less than 64.
Implementations§
Source§impl ShiftedValueIndex
impl ShiftedValueIndex
Sourcepub fn plain(value_index: ValueIndex) -> Self
pub fn plain(value_index: ValueIndex) -> Self
Create a value index that just uses the specified value. Equivalent to Self::sll
with
amount equals 0.
Sourcepub fn sll(value_index: ValueIndex, amount: usize) -> Self
pub fn sll(value_index: ValueIndex, amount: usize) -> Self
Shift Left Logical by the given number of bits.
§Panics
Panics if the shift amount is greater than or equal to 64.
Sourcepub fn srl(value_index: ValueIndex, amount: usize) -> Self
pub fn srl(value_index: ValueIndex, amount: usize) -> Self
Shift Right Logical by the given number of bits.
§Panics
Panics if the shift amount is greater than or equal to 64.
Sourcepub fn sar(value_index: ValueIndex, amount: usize) -> Self
pub fn sar(value_index: ValueIndex, amount: usize) -> Self
Shift Right Arithmetic by the given number of bits.
This is similar to the Shift Right Logical but instead of shifting in 0 bits it will replicate the sign bit.
§Panics
Panics if the shift amount is greater than or equal to 64.
Sourcepub fn rotr(value_index: ValueIndex, amount: usize) -> Self
pub fn rotr(value_index: ValueIndex, amount: usize) -> Self
Rotate Right by the given number of bits.
Rotates bits to the right, with bits shifted off the right end wrapping around to the left.
§Panics
Panics if the shift amount is greater than or equal to 64.
Sourcepub fn sll32(value_index: ValueIndex, amount: usize) -> Self
pub fn sll32(value_index: ValueIndex, amount: usize) -> Self
Shift Left Logical on 32-bit halves by the given number of bits.
Performs independent logical left shifts on the upper and lower 32-bit halves. Only uses the lower 5 bits of the shift amount (0-31).
§Panics
Panics if the shift amount is greater than or equal to 32.
Sourcepub fn srl32(value_index: ValueIndex, amount: usize) -> Self
pub fn srl32(value_index: ValueIndex, amount: usize) -> Self
Shift Right Logical on 32-bit halves by the given number of bits.
Performs independent logical right shifts on the upper and lower 32-bit halves. Only uses the lower 5 bits of the shift amount (0-31).
§Panics
Panics if the shift amount is greater than or equal to 32.
Sourcepub fn sra32(value_index: ValueIndex, amount: usize) -> Self
pub fn sra32(value_index: ValueIndex, amount: usize) -> Self
Shift Right Arithmetic on 32-bit halves by the given number of bits.
Performs independent arithmetic right shifts on the upper and lower 32-bit halves. Sign extends each 32-bit half independently. Only uses the lower 5 bits of the shift amount (0-31).
§Panics
Panics if the shift amount is greater than or equal to 32.
Sourcepub fn rotr32(value_index: ValueIndex, amount: usize) -> Self
pub fn rotr32(value_index: ValueIndex, amount: usize) -> Self
Rotate Right on 32-bit halves by the given number of bits.
Performs independent rotate right operations on the upper and lower 32-bit halves. Bits shifted off the right end wrap around to the left within each 32-bit half. Only uses the lower 5 bits of the shift amount (0-31).
§Panics
Panics if the shift amount is greater than or equal to 32.
Trait Implementations§
Source§impl Clone for ShiftedValueIndex
impl Clone for ShiftedValueIndex
Source§fn clone(&self) -> ShiftedValueIndex
fn clone(&self) -> ShiftedValueIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ShiftedValueIndex
impl Debug for ShiftedValueIndex
Source§impl DeserializeBytes for ShiftedValueIndex
impl DeserializeBytes for ShiftedValueIndex
fn deserialize(read_buf: impl Buf) -> Result<Self, SerializationError>where
Self: Sized,
Source§impl Hash for ShiftedValueIndex
impl Hash for ShiftedValueIndex
Source§impl Ord for ShiftedValueIndex
impl Ord for ShiftedValueIndex
Source§fn cmp(&self, other: &ShiftedValueIndex) -> Ordering
fn cmp(&self, other: &ShiftedValueIndex) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ShiftedValueIndex
impl PartialEq for ShiftedValueIndex
Source§impl PartialOrd for ShiftedValueIndex
impl PartialOrd for ShiftedValueIndex
Source§impl SerializeBytes for ShiftedValueIndex
impl SerializeBytes for ShiftedValueIndex
impl Copy for ShiftedValueIndex
impl Eq for ShiftedValueIndex
impl StructuralPartialEq for ShiftedValueIndex
Auto Trait Implementations§
impl Freeze for ShiftedValueIndex
impl RefUnwindSafe for ShiftedValueIndex
impl Send for ShiftedValueIndex
impl Sync for ShiftedValueIndex
impl Unpin for ShiftedValueIndex
impl UnwindSafe for ShiftedValueIndex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more