func Decode(dst, src []byte) ([]byte, error) {
	dLen, s, err := decodedLen(src)
	if err != nil {
		return nil, err
	}
	if dLen <= len(dst) {
		dst = dst[:dLen]
	} else {
		dst = make([]byte, dLen)
	}
	switch decode(dst, src[s:]) {
	case 0:
		return dst, nil
	case decodeErrCodeUnsupportedLiteralLength:
		return nil, errUnsupportedLiteralLength
	case decodeErrCodeUnsupportedCopy4Tag:
		return nil, errUnsupportedCopy4Tag
	}
	return nil, ErrCorrupt
}
Decode returns the decoded form of src. The returned slice may be a sub-
slice of dst if dst was large enough to hold the entire decoded block.
Otherwise, a newly allocated slice will be returned.

The dst and src must not overlap. It is valid to pass a nil dst.
package snappy
import (
	"encoding/binary"
	"errors"
	"io"
)
var (
	ErrCorrupt = errors.New("snappy: corrupt input")
	ErrTooLarge = errors.New("snappy: decoded block is too large")
	ErrUnsupported = errors.New("snappy: unsupported input")
	errUnsupportedCopy4Tag      = errors.New("snappy: unsupported COPY_4 tag")
	errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length")
)
func DecodedLen(src []byte) (int, error) {
	v, _, err := decodedLen(src)
	return v, err
}
func decodedLen(src []byte) (blockLen, headerLen int, err error) {
	v, n := binary.Uvarint(src)
	if n <= 0 || v > 0xffffffff {
		return 0, 0, ErrCorrupt
	}
	const wordSize = 32 << (^uint(0) >> 32 & 1)
	if wordSize == 32 && v > 0x7fffffff {
		return 0, 0, ErrTooLarge
	}
	return int(v), n, nil
}
const (
	decodeErrCodeCorrupt                  = 1
	decodeErrCodeUnsupportedLiteralLength = 2
	decodeErrCodeUnsupportedCopy4Tag      = 3
)