Skip to content

Commit

Permalink
compress/flate: cancel redundant operations
Browse files Browse the repository at this point in the history
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 <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: David Chase <[email protected]>
Reviewed-by: Joe Tsai <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
  • Loading branch information
heisen-li authored and gopherbot committed May 8, 2022
1 parent eed7757 commit b8d55a7
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/compress/flate/huffman_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b8d55a7

Please sign in to comment.