2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2020-08-15 22:01:38 -05:00
|
|
|
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff
|
2024-02-22 06:10:29 -06:00
|
|
|
//@ ignore-endian-big
|
2020-08-15 22:01:38 -05:00
|
|
|
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
pub fn foo(bytes: [u8; 16]) -> Option<[u8; 4]> {
|
|
|
|
// big endian `u32`s
|
|
|
|
let dwords: [u32; 4] = unsafe { transmute(bytes) };
|
|
|
|
const FF: u32 = 0x0000_ffff_u32.to_be();
|
2024-06-02 19:18:33 -05:00
|
|
|
if let [0, 0, 0 | FF, ip] = dwords { Some(unsafe { transmute(ip) }) } else { None }
|
2020-08-15 22:01:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2021-06-03 02:31:27 -05:00
|
|
|
let _ = foo([0; 16]);
|
2020-08-15 22:01:38 -05:00
|
|
|
}
|