aboutsummaryrefslogtreecommitdiff
path: root/src/compress
diff options
context:
space:
mode:
authorHeisenberg <lziqiang1@gmail.com>2020-07-22 08:59:30 +0800
committerGopher Robot <gobot@golang.org>2022-05-08 17:05:16 +0000
commitb8d55a7604aaffb9645ba1fcff9ea2c84697f7d6 (patch)
tree379f45b3ade77ac4c3861da6d3b82571a8c0795d /src/compress
parenteed77574d029e8c8426195bc9e7267462f568a8a (diff)
downloadgo-b8d55a7604aaffb9645ba1fcff9ea2c84697f7d6.tar.gz
go-b8d55a7604aaffb9645ba1fcff9ea2c84697f7d6.zip
compress/flate: cancel redundant operations
The assignment operation in the program seems to be redundant, the first judgment will continue to overwrite the previous value. The subsequent slicing operation will cut all the values without frequency. Change-Id: Id59fc36dd5bacfde881edaf0d9c1af5348286611 Reviewed-on: https://go-review.googlesource.com/c/go/+/244157 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Joe Tsai <joetsai@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/compress')
-rw-r--r--src/compress/flate/huffman_code.go2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/compress/flate/huffman_code.go b/src/compress/flate/huffman_code.go
index 07b7827e1a..9b64d15e75 100644
--- a/src/compress/flate/huffman_code.go
+++ b/src/compress/flate/huffman_code.go
@@ -288,11 +288,9 @@ func (h *huffmanEncoder) generate(freq []int32, maxBits int32) {
list[count] = literalNode{uint16(i), f}
count++
} else {
- list[count] = literalNode{}
h.codes[i].len = 0
}
}
- list[len(freq)] = literalNode{}
list = list[:count]
if count <= 2 {