(src, buf []byte)
| 1063 | } |
| 1064 | |
| 1065 | func lz4Compress(src, buf []byte) (int, error) { |
| 1066 | n, err := lz4.CompressBlock(src, buf[4:], nil) |
| 1067 | if err != nil { |
| 1068 | return -1, err |
| 1069 | } else if n == 0 { |
| 1070 | return -1, errNotCompressible |
| 1071 | } |
| 1072 | |
| 1073 | // The compressed block is prefixed by the size of the uncompressed data. |
| 1074 | binary.BigEndian.PutUint32(buf, uint32(len(src))) |
| 1075 | |
| 1076 | return n + 4, nil |
| 1077 | } |
| 1078 | |
| 1079 | func lz4Decompress(src []byte) ([]byte, error) { |
| 1080 | if len(src) < 4 { |
no outgoing calls