From e0e4891827a3db12daa74859d9d487aeaa536c23 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 24 May 2017 13:52:56 -0700 Subject: [PATCH] compress/bzip2: remove dead code in huffman.go The logic performs a series of shifts, which are useless given that they are followed by an assignment that overrides the value of the previous computation. I suspect (but cannot prove) that this is leftover logic from an original approach that attempted to store both the Huffman code and the length within the same variable instead of using two different variables as it currently does now. Fixes #17949 Change-Id: Ibf6c807c6cef3b28bfdaf2b68d9bc13503ac21b2 Reviewed-on: https://go-review.googlesource.com/44091 Reviewed-by: Ian Lance Taylor --- src/compress/bzip2/huffman.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compress/bzip2/huffman.go b/src/compress/bzip2/huffman.go index 9d574b9bde..dbba9a58b5 100644 --- a/src/compress/bzip2/huffman.go +++ b/src/compress/bzip2/huffman.go @@ -108,10 +108,6 @@ func newHuffmanTree(lengths []uint8) (huffmanTree, error) { codes := huffmanCodes(make([]huffmanCode, len(lengths))) for i := len(pairs) - 1; i >= 0; i-- { if length > pairs[i].length { - // If the code length decreases we shift in order to - // zero any bits beyond the end of the code. - length >>= 32 - pairs[i].length - length <<= 32 - pairs[i].length length = pairs[i].length } codes[i].code = code