]> git.lizzy.rs Git - rust.git/blob - tests/ui/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / numbers-arithmetic / next-power-of-two-overflow-ndebug.rs
1 // run-pass
2 // compile-flags: -C debug_assertions=no
3 // ignore-emscripten dies with an LLVM error
4
5 fn main() {
6     for i in 129..256 {
7         assert_eq!((i as u8).next_power_of_two(), 0);
8     }
9
10     assert_eq!(((1u16 << 15) + 1).next_power_of_two(), 0);
11     assert_eq!(((1u32 << 31) + 1).next_power_of_two(), 0);
12     assert_eq!(((1u64 << 63) + 1).next_power_of_two(), 0);
13     assert_eq!(((1u128 << 127) + 1).next_power_of_two(), 0);
14 }