Source file
test/fixedbugs/issue48473.go
1
2
3
4
5
6
7 package main
8
9 import "fmt"
10
11 func f(x uint64) uint64 {
12 s := "\x04"
13 c := s[0]
14 return x - x<<c<<4
15 }
16
17 func g(x uint32) uint32 {
18 s := "\x04"
19 c := s[0]
20 return x - x<<c<<4
21 }
22
23 func main() {
24 if want, got := uint64(0xffffffffffffff01), f(1); want != got {
25 panic(fmt.Sprintf("want %x got %x", want, got))
26 }
27 if want, got := uint32(0xffffff01), g(1); want != got {
28 panic(fmt.Sprintf("want %x got %x", want, got))
29 }
30 }
31
View as plain text