fn internal_infallible_bitwise_bool(
        &mut self,
        protocol: Protocol,
        integer_op: fn(i64, i64) -> i64,
        bool_op: fn(bool, bool) -> bool,
        lhs: InstAddress,
        rhs: InstAddress,
    ) -> Result<(), VmError> {
        let rhs = self.stack.address(rhs)?;
        let lhs = self.stack.address(lhs)?;

        let (lhs, rhs) = match (lhs, rhs) {
            (Value::Integer(lhs), Value::Integer(rhs)) => {
                self.stack.push(integer_op(lhs, rhs));
                return Ok(());
            }
            (Value::Bool(lhs), Value::Bool(rhs)) => {
                self.stack.push(bool_op(lhs, rhs));
                return Ok(());
            }
            (lhs, rhs) => (lhs, rhs),
        };

        if !self.call_instance_fn(lhs.clone(), protocol, (&rhs,))? {
            return Err(VmError::from(VmErrorKind::UnsupportedBinaryOperation {
                op: protocol.name,
                lhs: lhs.type_info()?,
                rhs: rhs.type_info()?,
            }));
        }

        Ok(())
    }
/// Internal impl of a numeric operation.
Internal impl of a numeric operation.
Internal impl of a numeric operation .
fn internal_infallible_bitwise_bool(
        &mut self,
        protocol: Protocol,
        integer_op: fn(i64, i64) -> i64,
        bool_op: fn(bool, bool) -> bool,
        lhs: InstAddress,
        rhs: InstAddress,
    ) -> Result<(), VmError> {
        let rhs = self.stack.address(rhs)?;
        let lhs = self.stack.address(lhs)?;
        let (lhs, rhs) = match (lhs, rhs) {
            (Value::Integer(lhs), Value::Integer(rhs)) => {
                self.stack.push(integer_op(lhs, rhs));
                return Ok(());
            }
            (Value::Bool(lhs), Value::Bool(rhs)) => {
                self.stack.push(bool_op(lhs, rhs));
                return Ok(());
            }
            (lhs, rhs) => (lhs, rhs),
        };
        if !self.call_instance_fn(lhs.clone(), protocol, (&rhs,))? {
            return Err(VmError::from(VmErrorKind::UnsupportedBinaryOperation {
                op: protocol.name,
                lhs: lhs.type_info()?,
                rhs: rhs.type_info()?,
            }));
        }
        Ok(())
    }
fn internal_infallible_bitwise_bool ( & mut self , protocol : Protocol , integer_op : fn ( i64 , i64 ) -> i64 , bool_op : fn ( bool , bool ) -> bool , lhs : InstAddress , rhs : InstAddress , ) -> Result < ( ) , VmError > { let rhs = self . stack . address ( rhs ) ? ; let lhs = self . stack . address ( lhs ) ? ; let ( lhs , rhs ) = match ( lhs , rhs ) { ( Value :: Integer ( lhs ) , Value :: Integer ( rhs ) ) => { self . stack . push ( integer_op ( lhs , rhs ) ) ; return Ok ( ( ) ) ; } ( Value :: Bool ( lhs ) , Value :: Bool ( rhs ) ) => { self . stack . push ( bool_op ( lhs , rhs ) ) ; return Ok ( ( ) ) ; } ( lhs , rhs ) => ( lhs , rhs ) , } ; if ! self . call_instance_fn ( lhs . clone ( ) , protocol , ( & rhs , ) ) ? { return Err ( VmError :: from ( VmErrorKind :: UnsupportedBinaryOperation { op : protocol . name , lhs : lhs . type_info ( ) ? , rhs : rhs . type_info ( ) ? , } ) ) ; } Ok ( ( ) ) }
Internal impl of a numeric operation.
Internal impl of a numeric operation .
&mut self
protocol
Protocol
integer_op
fn(i64, i64) -> i64
bool_op
fn(bool, bool) -> bool
lhs
InstAddress
rhs
InstAddress
&mut self
protocol
Protocol
integer_op
fn(i64, i64) -> i64
bool_op
fn(bool, bool) -> bool
lhs
InstAddress
rhs
InstAddress