Commit 5ea131f4 authored by David Crawshaw's avatar David Crawshaw

runtime: compare only until min(len(s1), len(s2))

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/139770043
parent f852034e
......@@ -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++ {
......
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