aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/slice.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/runtime/slice.go b/src/runtime/slice.go
index 4fb2adc1f9..e427a8b7cc 100644
--- a/src/runtime/slice.go
+++ b/src/runtime/slice.go
@@ -92,7 +92,7 @@ func growslice(t *slicetype, old sliceStruct, n int64) sliceStruct {
}
func slicecopy(to sliceStruct, fm sliceStruct, width uintptr) int {
- if fm.len == 0 || to.len == 0 || width == 0 {
+ if fm.len == 0 || to.len == 0 {
return 0
}
@@ -101,6 +101,10 @@ func slicecopy(to sliceStruct, fm sliceStruct, width uintptr) int {
n = to.len
}
+ if width == 0 {
+ return n
+ }
+
if raceenabled {
callerpc := getcallerpc(unsafe.Pointer(&to))
pc := funcPC(slicecopy)