1// run 2 3// Copyright 2018 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 9func mask1(a, b uint64) uint64 { 10 op1 := int32(a) 11 op2 := int32(b) 12 return uint64(uint32(op1 / op2)) 13} 14 15var mask2 = mask1 16 17func main() { 18 res1 := mask1(0x1, 0xfffffffeffffffff) 19 res2 := mask2(0x1, 0xfffffffeffffffff) 20 if res1 != 0xffffffff { 21 println("got", res1, "want", 0xffffffff) 22 panic("FAIL") 23 } 24 if res2 != 0xffffffff { 25 println("got", res2, "want", 0xffffffff) 26 panic("FAIL") 27 } 28} 29