From 7c82f60b602f3bbd6378eac3e8e004e62eb44193 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 10 Jul 2023 15:52:25 +0800 Subject: [PATCH] chore: use copy instead of a loop --- zstd/seqdec.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/zstd/seqdec.go b/zstd/seqdec.go index 9405fcf101..d7ed017f26 100644 --- a/zstd/seqdec.go +++ b/zstd/seqdec.go @@ -197,9 +197,7 @@ func (s *sequenceDecs) execute(seqs []seqVals, hist []byte) error { dst = dst[:len(src)] t += len(src) // Destination is the space we just added. - for i := range src { - dst[i] = src[i] - } + copy(dst, src) } } } @@ -395,9 +393,7 @@ func (s *sequenceDecs) decodeSync(hist []byte) error { // Destination is the space we just added. dst := out[len(out)-ml:] dst = dst[:len(src)] - for i := range src { - dst[i] = src[i] - } + copy(dst, src) } } if i == 0 {