fn bake(
        &self,
        a: InstructionArgument,
        b: InstructionArgument,
    ) -> (Word, Option<Word>, Option<Word>) {
        let opcode = match self {
            Self::SET => 0x1,
            Self::ADD => 0x2,
            Self::SUB => 0x3,
            Self::MUL => 0x4,
            Self::DIV => 0x5,
            Self::MOD => 0x6,
            Self::SHL => 0x7,
            Self::SHR => 0x8,
            Self::AND => 0x9,
            Self::BOR => 0xA,
            Self::XOR => 0xB,
            Self::IFE => 0xC,
            Self::IFN => 0xD,
            Self::IFG => 0xE,
            Self::IFB => 0xF,
        };

        let a_baked = a.bake_argument();
        let b_baked = b.bake_argument();

        let instruction = ((opcode & 0b1111)
            | ((a_baked.inline as u32 & 0b111_111) << 4)
            | ((b_baked.inline as u32 & 0b111_111) << 10)) as Word;
        if a_baked.literal.is_some() {
            (instruction, a_baked.literal, b_baked.literal)
        } else {
            (instruction, b_baked.literal, None)
        }
    }
/// Bakes the instruction and its arguments into bytecode.
Bakes the instruction and its arguments into bytecode.
Bakes the instruction and its arguments into bytecode .
fn bake(
        &self,
        a: InstructionArgument,
        b: InstructionArgument,
    ) -> (Word, Option<Word>, Option<Word>) {
        let opcode = match self {
            Self::SET => 0x1,
            Self::ADD => 0x2,
            Self::SUB => 0x3,
            Self::MUL => 0x4,
            Self::DIV => 0x5,
            Self::MOD => 0x6,
            Self::SHL => 0x7,
            Self::SHR => 0x8,
            Self::AND => 0x9,
            Self::BOR => 0xA,
            Self::XOR => 0xB,
            Self::IFE => 0xC,
            Self::IFN => 0xD,
            Self::IFG => 0xE,
            Self::IFB => 0xF,
        };
        let a_baked = a.bake_argument();
        let b_baked = b.bake_argument();
        let instruction = ((opcode & 0b1111)
            | ((a_baked.inline as u32 & 0b111_111) << 4)
            | ((b_baked.inline as u32 & 0b111_111) << 10)) as Word;
        if a_baked.literal.is_some() {
            (instruction, a_baked.literal, b_baked.literal)
        } else {
            (instruction, b_baked.literal, None)
        }
    }
fn bake ( & self , a : InstructionArgument , b : InstructionArgument , ) -> ( Word , Option < Word > , Option < Word > ) { let opcode = match self { Self :: SET => 0x1 , Self :: ADD => 0x2 , Self :: SUB => 0x3 , Self :: MUL => 0x4 , Self :: DIV => 0x5 , Self :: MOD => 0x6 , Self :: SHL => 0x7 , Self :: SHR => 0x8 , Self :: AND => 0x9 , Self :: BOR => 0xA , Self :: XOR => 0xB , Self :: IFE => 0xC , Self :: IFN => 0xD , Self :: IFG => 0xE , Self :: IFB => 0xF , } ; let a_baked = a . bake_argument ( ) ; let b_baked = b . bake_argument ( ) ; let instruction = ( ( opcode & 0b1111 ) | ( ( a_baked . inline as u32 & 0b111_111 ) << 4 ) | ( ( b_baked . inline as u32 & 0b111_111 ) << 10 ) ) as Word ; if a_baked . literal . is_some ( ) { ( instruction , a_baked . literal , b_baked . literal ) } else { ( instruction , b_baked . literal , None ) } }
Bakes the instruction and its arguments into bytecode.
Bakes the instruction and its arguments into bytecode .
&self
a
InstructionArgument
b
InstructionArgument