aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index cfe2959b36..5c83895995 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -86,6 +86,11 @@ func slicebytetostring(buf *tmpBuf, b []byte) (str string) {
if msanenabled {
msanread(unsafe.Pointer(&b[0]), uintptr(l))
}
+ if l == 1 {
+ stringStructOf(&str).str = unsafe.Pointer(&staticbytes[b[0]])
+ stringStructOf(&str).len = 1
+ return
+ }
var p unsafe.Pointer
if buf != nil && len(b) <= len(buf) {