|
Raph |
at Dec 23, 2012 at 2:22 am
|
⇧ |
| |
Thanks for the review. There were also problems caused by the patch
being against "release" rather than the current development branch, but
hopefully that's all resolved now.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.goFile src/pkg/compress/flate/inflate.go (left):
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#oldcode58src/pkg/compress/flate/inflate.go:58: // J. Brian Connell, ``A
Huffman-Shannon-Fano Code,''
On 2012/12/22 14:19:00, rsc wrote:
I don't mind losing this comment if it's no longer relevant, but could you
please add a comment explaining or pointing to a reference for the new
algorithm?
Done.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.goFile src/pkg/compress/flate/inflate.go (right):
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode61src/pkg/compress/flate/inflate.go:61: // chunk & 15 is number of bits
On 2012/12/22 14:19:00, rsc wrote:
Can this fit in uint16? You're only using 4 bits of the bottom 16 and perhaps
not many of the top 16 either.
I think in the worst case the table link indices can be 13 bits, so it
doesn't quite fit. This would be a highly artificial case, of course,
but if it can happen we should decode it correctly.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode71src/pkg/compress/flate/inflate.go:71: chunks [huffmanNumChunks]uint32
On 2012/12/22 14:19:00, rsc wrote:
Please add comments describing the meaning of these fields.
I think that if the data structure is documented clearly the code will become
more clear too.
Done.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode114src/pkg/compress/flate/inflate.go:114: reverse = reverse >>
uint(16-huffmanChunkBits)
On 2012/12/22 14:19:00, rsc wrote:
reverse >>= 16 - huffmanChunkBits
Done.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode132src/pkg/compress/flate/inflate.go:132: here := uint32((i << 16) + n)
On 2012/12/22 14:19:00, rsc wrote:
Does here mean something / stand for something? It's an unusual name, and I
can't figure out what it means.
Changed it to "chunk." I believe "here" is the name used in zlib, but
agree it's confusing.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode134src/pkg/compress/flate/inflate.go:134: reverse = reverse >> uint(16-n)
On 2012/12/22 14:19:00, rsc wrote:
reverse >>= uint(16 - n)
Done.
https://codereview.appspot.com/6872063/diff/8002/src/pkg/compress/flate/inflate.go#newcode556src/pkg/compress/flate/inflate.go:556: // Read f.dataLen bytes into
history,
On 2012/12/22 14:19:00, rsc wrote:
This new comment seems wrong - it says dataLen not copyLen.
I also don't understand why it moved inside the function instead of
being a doc comment. Could you put the old one back?
This is actually because of version confusion between release and
default. Hopefully it's all resolved now.
https://codereview.appspot.com/6872063/