rust/crates/core_simd/tests/to_bytes.rs
Caleb Zulawski 732b7edfab
Add fmt and clippy to CI (#147)
* Add fmt and clippy to CI
* Add rust components
* Fix formatting
2021-07-23 17:43:53 -07:00

13 lines
331 B
Rust

#![feature(portable_simd)]
use core_simd::SimdU32;
#[test]
fn byte_convert() {
let int = SimdU32::from_array([0xdeadbeef, 0x8badf00d]);
let bytes = int.to_ne_bytes();
assert_eq!(int[0].to_ne_bytes(), bytes[..4]);
assert_eq!(int[1].to_ne_bytes(), bytes[4..]);
assert_eq!(SimdU32::from_ne_bytes(bytes), int);
}