]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/bswap-const.rs
Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser
[rust.git] / tests / ui / consts / bswap-const.rs
1 // run-pass
2
3 #![feature(core_intrinsics)]
4
5 use std::intrinsics;
6
7 const SWAPPED_U8: u8 = intrinsics::bswap(0x12_u8);
8 const SWAPPED_U16: u16 = intrinsics::bswap(0x12_34_u16);
9 const SWAPPED_I32: i32 = intrinsics::bswap(0x12_34_56_78_i32);
10
11 fn main() {
12     assert_eq!(SWAPPED_U8, 0x12);
13     assert_eq!(SWAPPED_U16, 0x34_12);
14     assert_eq!(SWAPPED_I32, 0x78_56_34_12);
15 }