2021-07-27 23:19:31 -05:00
|
|
|
#![feature(portable_simd, const_generics, const_evaluatable_checked)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
#![cfg(feature = "const_evaluatable_checked")]
|
2021-07-19 18:13:24 -05:00
|
|
|
|
2021-05-24 07:37:15 -05:00
|
|
|
use core_simd::SimdU32;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn byte_convert() {
|
|
|
|
let int = SimdU32::from_array([0xdeadbeef, 0x8badf00d]);
|
|
|
|
let bytes = int.to_ne_bytes();
|
2021-07-23 19:43:53 -05:00
|
|
|
assert_eq!(int[0].to_ne_bytes(), bytes[..4]);
|
2021-05-24 07:37:15 -05:00
|
|
|
assert_eq!(int[1].to_ne_bytes(), bytes[4..]);
|
|
|
|
assert_eq!(SimdU32::from_ne_bytes(bytes), int);
|
|
|
|
}
|