pub enum AluOp {
Add,
Sub,
Mul,
And,
Or,
Xor,
Shl,
Shr,
UShr,
}Expand description
The straight-line ALU ops a dispatch-free residual is built from (the alu.v ops, each
already proven ≡ the VM). 64-bit signed, wrapping — bit-identical to the VM’s Int.
Variants§
Add
Sub
Mul
And
Bitwise AND / OR / XOR — combinational, bit-identical to the VM’s Int bitwise ops (and, for 0/1
Bool operands, to the logical spellings, since &/|/^ agree with &&/||/xor on {0,1}).
Or
Xor
Shl
Logical shift left a << (b & 63) (the VM’s wrapping_shl, count masked mod 64).
Shr
ARITHMETIC shift right a >>> (b & 63) (the VM’s wrapping_shr on the signed Int).
UShr
LOGICAL (unsigned) shift right (a as u64) >> (b & 63) — zero-fill, the Word64/Keccak word64Shr
(wrapping_shr on the u64 value). Distinct from AluOp::Shr, which sign-extends: they agree only
while the high bit is clear (why the Word32 lane, always in 0..2³², reuses Shr), but a Word64 value
with bit 63 set needs this zero-fill form.
Implementations§
Source§impl AluOp
impl AluOp
Sourcepub fn eval_checked(&self, a: i64, b: i64) -> Result<i64, Divergence>
pub fn eval_checked(&self, a: i64, b: i64) -> Result<i64, Divergence>
The VM’s value for this op on two Ints, or the divergence that keeps the word from being it. + − ×
are exact in the VM (they promote); the bitwise ops and the masked shifts are the VM’s own i64 ops.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AluOp
impl<'de> Deserialize<'de> for AluOp
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for AluOp
impl Ord for AluOp
Source§impl PartialOrd for AluOp
impl PartialOrd for AluOp
impl Copy for AluOp
impl Eq for AluOp
impl StructuralPartialEq for AluOp
Auto Trait Implementations§
impl Freeze for AluOp
impl RefUnwindSafe for AluOp
impl Send for AluOp
impl Sync for AluOp
impl Unpin for AluOp
impl UnsafeUnpin for AluOp
impl UnwindSafe for AluOp
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.