...
Source file src/pkg/cmd/compile/internal/types/utils.go
1
2
3
4
5 package types
6
7 import (
8 "cmd/internal/obj"
9 "fmt"
10 )
11
12 const BADWIDTH = -1000000000
13
14
15
16
17 var (
18 Widthptr int
19 Dowidth func(*Type)
20 Fatalf func(string, ...interface{})
21 Sconv func(*Sym, int, int) string
22 Tconv func(*Type, int, int, int) string
23 FormatSym func(*Sym, fmt.State, rune, int)
24 FormatType func(*Type, fmt.State, rune, int)
25 TypeLinkSym func(*Type) *obj.LSym
26 Ctxt *obj.Link
27
28 FmtLeft int
29 FmtUnsigned int
30 FErr int
31 )
32
33 func (s *Sym) String() string {
34 return Sconv(s, 0, FErr)
35 }
36
37 func (sym *Sym) Format(s fmt.State, verb rune) {
38 FormatSym(sym, s, verb, FErr)
39 }
40
41 func (t *Type) String() string {
42
43
44
45
46 return Tconv(t, 0, FErr, 0)
47 }
48
49
50
51
52 func (t *Type) ShortString() string {
53 return Tconv(t, FmtLeft, FErr, 0)
54 }
55
56
57
58
59 func (t *Type) LongString() string {
60 return Tconv(t, FmtLeft|FmtUnsigned, FErr, 0)
61 }
62
63 func (t *Type) Format(s fmt.State, verb rune) {
64 FormatType(t, s, verb, FErr)
65 }
66
67 type bitset8 uint8
68
69 func (f *bitset8) set(mask uint8, b bool) {
70 if b {
71 *(*uint8)(f) |= mask
72 } else {
73 *(*uint8)(f) &^= mask
74 }
75 }
76
View as plain text