Function mm0b_parser::write_cmd[][src]

pub fn write_cmd(w: &mut impl Write, cmd: u8, data: u32) -> Result<()>
Expand description

Encode the command cmd (one of the STMT_*, PROOF_* or UNIFY_* commands in this module, which are all 6 bit numbers) with the given data field according to the following scheme:

  • cmd | 0x00 for data = 0
  • cmd | 0x40, data:u8 for 8 bit data
  • cmd | 0x80, data:u16 for 16 bit data
  • cmd | 0xC0, data:u32 for 32 bit data

where we select the shortest available encoding given the value of data.