You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
352 B

pub struct Spir {
pub code: Vec<u32>,
pub size: usize,
}
impl Spir {
pub fn read(bytecode: &[u8]) -> Spir {
let mut code = Vec::with_capacity(bytecode.len() / 4);
for word in bytecode.chunks_exact(4) {
code.push(u32::from_le_bytes([word[0], word[1], word[2], word[3]]));
}
let size = code.len() * 4;
Spir { code, size }
}
}
// EOF