Skip to main content

vyre_reference/dual_impls/bitwise/not/
reference_a.rs

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