From 5ea131f442cf1bb1fa9ce1029054838af974f0e8 Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Thu, 28 Aug 2014 12:07:52 -0400 Subject: [PATCH] runtime: compare only until min(len(s1), len(s2)) LGTM=bradfitz R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/139770043 --- src/pkg/runtime/noasm_arm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pkg/runtime/noasm_arm.go b/src/pkg/runtime/noasm_arm.go index 01f4116f2ac..dd3ef826766 100644 --- a/src/pkg/runtime/noasm_arm.go +++ b/src/pkg/runtime/noasm_arm.go @@ -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++ {