libemei/insts/
mod.rs

1pub mod riscv;
2pub mod x86_64;
3
4#[derive(Debug, Clone, Copy)]
5pub enum ImmByte {
6    Bit8,
7    Bit16,
8    Bit32,
9    Bit64,
10}
11
12impl ImmByte {
13    pub fn encode(self, imm: u64) -> Vec<u8> {
14        if let ImmByte::Bit8 = self {
15            (imm as u8).to_ne_bytes().to_vec()
16        } else if let ImmByte::Bit16 = self {
17            (imm as u16).to_ne_bytes().to_vec()
18        } else if let ImmByte::Bit32 = self {
19            (imm as u32).to_ne_bytes().to_vec()
20        } else {
21            imm.to_ne_bytes().to_vec()
22        }
23    }
24}
25
26
27#[derive(Debug, Clone)]
28pub struct LinkError(pub String);