Source file
test/fixedbugs/issue66066.go
1
2
3
4
5
6
7 package main
8
9 import "fmt"
10
11 func main() {
12 testMod()
13 testMul()
14 }
15
16
17 func mod3(x uint32) uint64 {
18 return uint64(x % 3)
19 }
20
21 func testMod() {
22 got := mod3(1<<32 - 1)
23 want := uint64((1<<32 - 1) % 3)
24 if got != want {
25 fmt.Printf("testMod: got %x want %x\n", got, want)
26 }
27
28 }
29
30
31 func mul3(a uint32) uint64 {
32 return uint64(a * 3)
33 }
34
35 func testMul() {
36 got := mul3(1<<32 - 1)
37 want := uint64((1<<32-1)*3 - 2<<32)
38 if got != want {
39 fmt.Printf("testMul: got %x want %x\n", got, want)
40 }
41 }
42
View as plain text