1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
import (
"cmd/internal/obj"
"fmt"
)
const BADWIDTH = -1000000000
// The following variables must be initialized early by the frontend.
// They are here to break import cycles.
// TODO(gri) eliminate these dependencies.
var (
Widthptr int
Dowidth func(*Type)
SymString func(*Sym) string
TypeString func(*Type) string
TypeShortString func(*Type) string
TypeLongString func(*Type) string
FormatSym func(*Sym, fmt.State, rune)
FormatType func(*Type, fmt.State, rune)
TypeLinkSym func(*Type) *obj.LSym
)
func (s *Sym) String() string {
return SymString(s)
}
func (sym *Sym) Format(s fmt.State, verb rune) {
FormatSym(sym, s, verb)
}
func (t *Type) String() string {
// The implementation
// must handle recursive types correctly.
return TypeString(t)
}
// ShortString generates a short description of t.
// It is used in autogenerated method names, reflection,
// and itab names.
func (t *Type) ShortString() string {
return TypeShortString(t)
}
// LongString generates a complete description of t.
// It is useful for reflection,
// or when a unique fingerprint or hash of a type is required.
func (t *Type) LongString() string {
return TypeLongString(t)
}
func (t *Type) Format(s fmt.State, verb rune) {
FormatType(t, s, verb)
}
type bitset8 uint8
func (f *bitset8) set(mask uint8, b bool) {
if b {
*(*uint8)(f) |= mask
} else {
*(*uint8)(f) &^= mask
}
}
|