vyre-reference 0.4.1

Pure-Rust CPU reference interpreter for vyre IR — byte-identical oracle for backend conformance and small-data fallback
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//! Direct u32 XOR reference for `primitive.bitwise.xor`.

/// Compute XOR from the first two little-endian `u32` words in `input`.
pub fn reference(input: &[u8]) -> Vec<u8> {
    if input.len() < 8 {
        return vec![0; 4];
    }

    let left = u32::from_le_bytes([input[0], input[1], input[2], input[3]]);
    let right = u32::from_le_bytes([input[4], input[5], input[6], input[7]]);
    (left ^ right).to_le_bytes().to_vec()
}