// writeMatch writes the match at the top of the dictionary. The given
// distance must point in the current dictionary and the length must not
// exceed the maximum length 273 supported in LZMA.
//
// The error value ErrNoSpace indicates that no space is available in
// the dictionary for writing. You need to read from the dictionary
// first.
writeMatch writes the match at the top of the dictionary. The given
distance must point in the current dictionary and the length must not
exceed the maximum length 273 supported in LZMA.

The error value ErrNoSpace indicates that no space is available in
the dictionary for writing. You need to read from the dictionary
first.
// writeMatch writes the match at the top of the dictionary . The given // distance must point in the current dictionary and the length must not // exceed the maximum length 273 supported in LZMA . // // The error value ErrNoSpace indicates that no space is available in // the dictionary for writing . You need to read from the dictionary // first .
func (d *decoderDict) writeMatch(dist int64, length int) error {
	if !(0 < dist && dist <= int64(d.dictLen())) {
		return errors.New("writeMatch: distance out of range")
	}
	if !(0 < length && length <= maxMatchLen) {
		return errors.New("writeMatch: length out of range")
	}
	if length > d.buf.Available() {
		return ErrNoSpace
	}
	d.head += int64(length)
	i := d.buf.front - int(dist)
	if i < 0 {
		i += len(d.buf.data)
	}
	for length > 0 {
		var p []byte
		if i >= d.buf.front {
			p = d.buf.data[i:]
			i = 0
		} else {
			p = d.buf.data[i:d.buf.front]
			i = d.buf.front
		}
		if len(p) > length {
			p = p[:length]
		}
		if _, err := d.buf.Write(p); err != nil {
			panic(fmt.Errorf("d.buf.Write returned error %s", err))
		}
		length -= len(p)
	}
	return nil
}
func ( d * decoderDict ) writeMatch ( dist int64 , length int ) error { if ! ( 0 < dist && dist <= int64 ( d . dictLen ( ) ) ) { return errors . New ( " " ) } if ! ( 0 < length && length <= maxMatchLen ) { return errors . New ( " " ) } if length > d . buf . Available ( ) { return ErrNoSpace } d . head += int64 ( length ) i := d . buf . front - int ( dist ) if i < 0 { i += len ( d . buf . data ) } for length > 0 { var p [ ] byte if i >= d . buf . front { p = d . buf . data [ i : ] i = 0 } else { p = d . buf . data [ i : d . buf . front ] i = d . buf . front } if len ( p ) > length { p = p [ : length ] } if _ , err := d . buf . Write ( p ) ; err != nil { panic ( fmt . Errorf ( " " , err ) ) } length -= len ( p ) } return nil }
writeMatch writes the match at the top of the dictionary.
writeMatch writes the match at the top of the dictionary .