mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-02-19 21:40:34 +00:00
internal/impl: CompressGZIP: simplify
This simplifies the code and fixes the following linter warning reported by staticcheck: internal/impl/legacy_export.go:84:51: uint16(blockSize) ^ 0x0000 always equals uint16(blockSize) (SA4016) Similar code: https://cs.opensource.google/go/go/+/master:src/compress/flate/huffman_bit_writer.go;l=413-414;drc=19309779ac5e2f5a2fd3cbb34421dafb2855ac21 Change-Id: Id099b0de635f668d44f57bacd89b564337560254 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/406841 Reviewed-by: Cassondra Foesch <cfoesch@gmail.com> Reviewed-by: Lasse Folger <lassefolger@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
This commit is contained in:
parent
4db09f5dd7
commit
06eea5e15f
@ -81,8 +81,8 @@ func (Export) CompressGZIP(in []byte) (out []byte) {
|
||||
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
||||
blockSize = len(in)
|
||||
}
|
||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)
|
||||
binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)
|
||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize))
|
||||
binary.LittleEndian.PutUint16(blockHeader[3:5], ^uint16(blockSize))
|
||||
out = append(out, blockHeader[:]...)
|
||||
out = append(out, in[:blockSize]...)
|
||||
in = in[blockSize:]
|
||||
|
Loading…
x
Reference in New Issue
Block a user