Commit e07a4459 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd: replace x[i:][0] expressions with x[i]

Passes toolstash -cmp.

Change-Id: Id504e71ed1f23900e24a9aed25143c94f4d7d50c
Reviewed-on: https://go-review.googlesource.com/21899
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 98080a6c
......@@ -1087,7 +1087,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {
......
......@@ -611,7 +611,7 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {
......
......@@ -606,7 +606,7 @@ func aclass(ctxt *obj.Link, a *obj.Addr) int {
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab)
if a1 != 0 {
return &optab[a1-1:][0]
return &optab[a1-1]
}
a1 = int(p.From.Class)
if a1 == 0 {
......
......@@ -4452,9 +4452,8 @@ func asmins(ctxt *obj.Link, p *obj.Prog) {
}
n := ctxt.AsmBuf.Len()
var r *obj.Reloc
for i := len(ctxt.Cursym.R) - 1; i >= 0; i-- {
r = &ctxt.Cursym.R[i:][0]
r := &ctxt.Cursym.R[i]
if int64(r.Off) < p.Pc {
break
}
......
......@@ -17,9 +17,9 @@ import (
// ../gc/reflect.c stuffs in these.
func decode_reloc(s *LSym, off int32) *Reloc {
for i := 0; i < len(s.R); i++ {
for i := range s.R {
if s.R[i].Off == off {
return &s.R[i:][0]
return &s.R[i]
}
}
return nil
......
......@@ -774,7 +774,7 @@ func ldelf(f *bio.Reader, pkg string, length int64, pn string) {
if sym.sym == nil {
continue
}
sect = &elfobj.sect[sym.shndx:][0]
sect = &elfobj.sect[sym.shndx]
if sect.sym == nil {
if strings.HasPrefix(sym.name, ".Linfo_string") { // clang does this
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment