1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:14:51 -07:00

cmd/compile/internal/ssa: fix partsByVarOffset.Less method

Fix duplicated index in LHS and RHS of the < operator.

Found using https://go-critic.github.io/overview#dupSubExpr-ref

Change-Id: I9a5a40bbd436b32e8117579a01bc50afe3608c97
Reviewed-on: https://go-review.googlesource.com/122776
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Iskander Sharipov 2018-07-09 23:08:22 +03:00 committed by Brad Fitzpatrick
parent 94076feef5
commit 7951d90bc6

View File

@ -765,7 +765,7 @@ type partsByVarOffset struct {
func (a partsByVarOffset) Len() int { return len(a.slotIDs) }
func (a partsByVarOffset) Less(i, j int) bool {
return varOffset(a.slots[a.slotIDs[i]]) < varOffset(a.slots[a.slotIDs[i]])
return varOffset(a.slots[a.slotIDs[i]]) < varOffset(a.slots[a.slotIDs[j]])
}
func (a partsByVarOffset) Swap(i, j int) { a.slotIDs[i], a.slotIDs[j] = a.slotIDs[j], a.slotIDs[i] }