-
let a = [0b11110101u8, 0b01000000].as_bits::<Msb0>();
let a = &a[4..];
println!("{:?}", a);
let (p1, _) = a.split_at(6);
assert_eq!(p1, bits![0, 1, 0, 1, 0, 1]);
println!("{:?}", bits![u8, Msb0; 1, 0, 1, 0]);
assert_eq!(bits![u8, Msb0; 1, 0, 1, 0].load::<u8>(), 0b1010);
println!("{:?}", p1);
println!("{:?}", &p1[1..5]);
assert_eq!(p1[1..5].load::<u8>(), 0b1010); and result is:
Same bit sequence got different load result :( |
Beta Was this translation helpful? Give feedback.
Answered by
JackLiar
Aug 4, 2023
Replies: 1 comment
-
I see, load method uses machine endianness, not decide by Lsb0 nor Msb0. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
JackLiar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see, load method uses machine endianness, not decide by Lsb0 nor Msb0.