diff --git a/stream/mts/psi/crc.go b/stream/mts/psi/crc.go index 82736abd..a2e3fa9a 100644 --- a/stream/mts/psi/crc.go +++ b/stream/mts/psi/crc.go @@ -27,6 +27,7 @@ LICENSE package psi import ( + "encoding/binary" "hash/crc32" "math/bits" ) @@ -41,10 +42,7 @@ func addCrc(out []byte) []byte { // updateCrc updates the crc of bytes slice, writing the checksum into the last four bytes. func updateCrc(b []byte) []byte { crc32 := crc32_Update(0xffffffff, crc32_MakeTable(bits.Reverse32(crc32.IEEE)), b[1:len(b)-4]) - b[len(b)-4] = byte(crc32 >> 24) - b[len(b)-3] = byte(crc32 >> 16) - b[len(b)-2] = byte(crc32 >> 8) - b[len(b)-1] = byte(crc32) + binary.BigEndian.PutUint32(b[len(b)-4:], crc32) return b }