Skip to main content

vyre_reference/dual_impls/bitwise/and/
reference_a.rs

1//! Direct u32 AND reference for `primitive.bitwise.and`.
2
3/// Compute AND from the first two little-endian `u32` words in `input`.
4pub fn reference(input: &[u8]) -> Vec<u8> {
5    if input.len() < 8 {
6        return vec![0; 4];
7    }
8
9    let left = u32::from_le_bytes([input[0], input[1], input[2], input[3]]);
10    let right = u32::from_le_bytes([input[4], input[5], input[6], input[7]]);
11    (left & right).to_le_bytes().to_vec()
12}