mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: a few microoptimizations
Replace i < 0 || i >= x with uint(i) >= uint(x). Shorten a few other code sequences. Move the kind bits to the bottom of the flag word, to avoid shifts. LGTM=r R=r, bradfitz CC=golang-codereviews https://golang.org/cl/159020043
This commit is contained in:
parent
5e713062b4
commit
0d81b72e1b
3 changed files with 91 additions and 122 deletions
|
|
@ -490,7 +490,7 @@ func (t *uncommonType) Method(i int) (m Method) {
|
|||
if p.name != nil {
|
||||
m.Name = *p.name
|
||||
}
|
||||
fl := flag(Func) << flagKindShift
|
||||
fl := flag(Func)
|
||||
if p.pkgPath != nil {
|
||||
m.PkgPath = *p.pkgPath
|
||||
fl |= flagRO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue