mirror of
https://github.com/golang/go
synced 2024-10-01 05:38:32 -06:00
runtime: compare only until min(len(s1), len(s2))
LGTM=bradfitz R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/139770043
This commit is contained in:
parent
f852034eb0
commit
5ea131f442
@ -9,7 +9,7 @@ package runtime
|
||||
|
||||
func cmpstring(s1, s2 string) int {
|
||||
l := len(s1)
|
||||
if l < len(s2) {
|
||||
if len(s2) < l {
|
||||
l = len(s2)
|
||||
}
|
||||
for i := 0; i < l; i++ {
|
||||
@ -32,7 +32,7 @@ func cmpstring(s1, s2 string) int {
|
||||
|
||||
func cmpbytes(s1, s2 []byte) int {
|
||||
l := len(s1)
|
||||
if l < len(s2) {
|
||||
if len(s2) < l {
|
||||
l = len(s2)
|
||||
}
|
||||
for i := 0; i < l; i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user