1// run
2
3// Copyright 2015 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9var x uint16 = 0xffff
10var y uint16 = 0xfffe
11var a uint16 = 0x7000
12var b uint16 = 0x9000
13
14func main() {
15	// Make sure we truncate to smaller-width types after evaluating expressions.
16	// This is a problem for arm where there is no 16-bit comparison op.
17	if ^x != 0 {
18		panic("^uint16(0xffff) != 0")
19	}
20	if ^y != 1 {
21		panic("^uint16(0xfffe) != 1")
22	}
23	if -x != 1 {
24		panic("-uint16(0xffff) != 1")
25	}
26	if a+b != 0 {
27		panic("0x7000+0x9000 != 0")
28	}
29}
30