From 6d5bbc2a2877193e1319b9e626f408eda399666e Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Mon, 24 Feb 2025 20:46:59 +0800 Subject: [PATCH] strconv: use builtin min function in commonPrefixLenIgnoreCase To make code a bit simpler. Change-Id: I5c5dcc365f84deac1726de2f2d238c423d7e9f3d --- src/strconv/atof.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/strconv/atof.go b/src/strconv/atof.go index 8fc90425f6..fe0dfdce55 100644 --- a/src/strconv/atof.go +++ b/src/strconv/atof.go @@ -18,10 +18,7 @@ var optimize = true // set to false to force slow-path conversions for testing // prefix of s and prefix, with the character case of s ignored. // The prefix argument must be all lower-case. func commonPrefixLenIgnoreCase(s, prefix string) int { - n := len(prefix) - if n > len(s) { - n = len(s) - } + n := min(len(prefix), len(s)) for i := 0; i < n; i++ { c := s[i] if 'A' <= c && c <= 'Z' {