Debian Codegraph @

test/fixedbugs/issue9604.go

raw
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
7 package main
8
9 var x uint16 = 0xffff
10 var y uint16 = 0xfffe
11 var a uint16 = 0x7000
12 var b uint16 = 0x9000
13
14 func 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 }