modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug114.go (about) 1 // run 2 3 // Copyright 2009 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 const B32 = 1<<32 - 1 10 const C32 = (-1) & ((1 << 32) - 1) 11 const D32 = ^0 12 13 func main() { 14 if B32 != 0xFFFFFFFF { 15 println("1<<32 - 1 is", B32, "should be", 0xFFFFFFFF) 16 panic("fail") 17 } 18 if C32 != 0xFFFFFFFF { 19 println("(-1) & ((1<<32) - 1) is", C32, "should be", 0xFFFFFFFF) 20 panic("fail") 21 } 22 if D32 != -1 { 23 println("^0 is", D32, "should be", -1) 24 panic("fail") 25 } 26 }