fn assign_int<S>(
        self,
        spanned: S,
        target: &mut num::BigInt,
        operand: num::BigInt,
    ) -> Result<(), IrError>
    where
        S: Copy + Spanned,
    {
        use std::convert::TryFrom;
        use std::ops::{AddAssign, MulAssign, ShlAssign, ShrAssign, SubAssign};

        match self {
            IrAssignOp::Add => {
                target.add_assign(operand);
            }
            IrAssignOp::Sub => {
                target.sub_assign(operand);
            }
            IrAssignOp::Mul => {
                target.mul_assign(operand);
            }
            IrAssignOp::Div => {
                *target = target
                    .checked_div(&operand)
                    .ok_or_else(|| IrError::msg(spanned, "division by zero"))?;
            }
            IrAssignOp::Shl => {
                let operand =
                    u32::try_from(operand).map_err(|_| IrError::msg(spanned, "bad operand"))?;

                target.shl_assign(operand);
            }
            IrAssignOp::Shr => {
                let operand =
                    u32::try_from(operand).map_err(|_| IrError::msg(spanned, "bad operand"))?;

                target.shr_assign(operand);
            }
        }

        Ok(())
    }
/// Perform the given assign operation.
Perform the given assign operation.
Perform the given assign operation .
fn assign_int<S>(
        self,
        spanned: S,
        target: &mut num::BigInt,
        operand: num::BigInt,
    ) -> Result<(), IrError>
    where
        S: Copy + Spanned,
    {
        use std::convert::TryFrom;
        use std::ops::{AddAssign, MulAssign, ShlAssign, ShrAssign, SubAssign};
        match self {
            IrAssignOp::Add => {
                target.add_assign(operand);
            }
            IrAssignOp::Sub => {
                target.sub_assign(operand);
            }
            IrAssignOp::Mul => {
                target.mul_assign(operand);
            }
            IrAssignOp::Div => {
                *target = target
                    .checked_div(&operand)
                    .ok_or_else(|| IrError::msg(spanned, "division by zero"))?;
            }
            IrAssignOp::Shl => {
                let operand =
                    u32::try_from(operand).map_err(|_| IrError::msg(spanned, "bad operand"))?;
                target.shl_assign(operand);
            }
            IrAssignOp::Shr => {
                let operand =
                    u32::try_from(operand).map_err(|_| IrError::msg(spanned, "bad operand"))?;
                target.shr_assign(operand);
            }
        }
        Ok(())
    }
fn assign_int < S > ( self , spanned : S , target : & mut num :: BigInt , operand : num :: BigInt , ) -> Result < ( ) , IrError > where S : Copy + Spanned , { use std :: convert :: TryFrom ; use std :: ops :: { AddAssign , MulAssign , ShlAssign , ShrAssign , SubAssign } ; match self { IrAssignOp :: Add => { target . add_assign ( operand ) ; } IrAssignOp :: Sub => { target . sub_assign ( operand ) ; } IrAssignOp :: Mul => { target . mul_assign ( operand ) ; } IrAssignOp :: Div => { * target = target . checked_div ( & operand ) . ok_or_else ( | | IrError :: msg ( spanned , " " ) ) ? ; } IrAssignOp :: Shl => { let operand = u32 :: try_from ( operand ) . map_err ( | _ | IrError :: msg ( spanned , " " ) ) ? ; target . shl_assign ( operand ) ; } IrAssignOp :: Shr => { let operand = u32 :: try_from ( operand ) . map_err ( | _ | IrError :: msg ( spanned , " " ) ) ? ; target . shr_assign ( operand ) ; } } Ok ( ( ) ) }
Perform the given assign operation.
Perform the given assign operation .
self
spanned
S
target
&mut num::BigInt
operand
num::BigInt
self
spanned
S
target
&mut num::BigInt
operand
num::BigInt