// readOp decodes the next operation from the compressed stream. It
// returns the operation. If an explicit end of stream marker is
// identified the eos error is returned.
readOp decodes the next operation from the compressed stream. It
returns the operation. If an explicit end of stream marker is
identified the eos error is returned.
// readOp decodes the next operation from the compressed stream . It // returns the operation . If an explicit end of stream marker is // identified the eos error is returned .
func (d *decoder) readOp() (op operation, err error) {
	const eosDist = 1<<32 - 1
	state, state2, posState := d.State.states(d.Dict.head)
	b, err := d.State.isMatch[state2].Decode(d.rd)
	if err != nil {
		return nil, err
	}
	if b == 0 {
		op, err := d.decodeLiteral()
		if err != nil {
			return nil, err
		}
		d.State.updateStateLiteral()
		return op, nil
	}
	b, err = d.State.isRep[state].Decode(d.rd)
	if err != nil {
		return nil, err
	}
	if b == 0 {
		d.State.rep[3], d.State.rep[2], d.State.rep[1] =
			d.State.rep[2], d.State.rep[1], d.State.rep[0]
		d.State.updateStateMatch()
		n, err := d.State.lenCodec.Decode(d.rd, posState)
		if err != nil {
			return nil, err
		}
		d.State.rep[0], err = d.State.distCodec.Decode(d.rd, n)
		if err != nil {
			return nil, err
		}
		if d.State.rep[0] == eosDist {
			d.eosMarker = true
			return nil, errEOS
		}
		op = match{n: int(n) + minMatchLen,
			distance: int64(d.State.rep[0]) + minDistance}
		return op, nil
	}
	b, err = d.State.isRepG0[state].Decode(d.rd)
	if err != nil {
		return nil, err
	}
	dist := d.State.rep[0]
	if b == 0 {
		b, err = d.State.isRepG0Long[state2].Decode(d.rd)
		if err != nil {
			return nil, err
		}
		if b == 0 {
			d.State.updateStateShortRep()
			op = match{n: 1, distance: int64(dist) + minDistance}
			return op, nil
		}
	} else {
		b, err = d.State.isRepG1[state].Decode(d.rd)
		if err != nil {
			return nil, err
		}
		if b == 0 {
			dist = d.State.rep[1]
		} else {
			b, err = d.State.isRepG2[state].Decode(d.rd)
			if err != nil {
				return nil, err
			}
			if b == 0 {
				dist = d.State.rep[2]
			} else {
				dist = d.State.rep[3]
				d.State.rep[3] = d.State.rep[2]
			}
			d.State.rep[2] = d.State.rep[1]
		}
		d.State.rep[1] = d.State.rep[0]
		d.State.rep[0] = dist
	}
	n, err := d.State.repLenCodec.Decode(d.rd, posState)
	if err != nil {
		return nil, err
	}
	d.State.updateStateRep()
	op = match{n: int(n) + minMatchLen, distance: int64(dist) + minDistance}
	return op, nil
}
func ( d * decoder ) readOp ( ) ( op operation , err error ) { const eosDist = 1 << 32 - 1 state , state2 , posState := d . State . states ( d . Dict . head ) b , err := d . State . isMatch [ state2 ] . Decode ( d . rd ) if err != nil { return nil , err } if b == 0 { op , err := d . decodeLiteral ( ) if err != nil { return nil , err } d . State . updateStateLiteral ( ) return op , nil } b , err = d . State . isRep [ state ] . Decode ( d . rd ) if err != nil { return nil , err } if b == 0 { d . State . rep [ 3 ] , d . State . rep [ 2 ] , d . State . rep [ 1 ] = d . State . rep [ 2 ] , d . State . rep [ 1 ] , d . State . rep [ 0 ] d . State . updateStateMatch ( ) n , err := d . State . lenCodec . Decode ( d . rd , posState ) if err != nil { return nil , err } d . State . rep [ 0 ] , err = d . State . distCodec . Decode ( d . rd , n ) if err != nil { return nil , err } if d . State . rep [ 0 ] == eosDist { d . eosMarker = true return nil , errEOS } op = match { n : int ( n ) + minMatchLen , distance : int64 ( d . State . rep [ 0 ] ) + minDistance } return op , nil } b , err = d . State . isRepG0 [ state ] . Decode ( d . rd ) if err != nil { return nil , err } dist := d . State . rep [ 0 ] if b == 0 { b , err = d . State . isRepG0Long [ state2 ] . Decode ( d . rd ) if err != nil { return nil , err } if b == 0 { d . State . updateStateShortRep ( ) op = match { n : 1 , distance : int64 ( dist ) + minDistance } return op , nil } } else { b , err = d . State . isRepG1 [ state ] . Decode ( d . rd ) if err != nil { return nil , err } if b == 0 { dist = d . State . rep [ 1 ] } else { b , err = d . State . isRepG2 [ state ] . Decode ( d . rd ) if err != nil { return nil , err } if b == 0 { dist = d . State . rep [ 2 ] } else { dist = d . State . rep [ 3 ] d . State . rep [ 3 ] = d . State . rep [ 2 ] } d . State . rep [ 2 ] = d . State . rep [ 1 ] } d . State . rep [ 1 ] = d . State . rep [ 0 ] d . State . rep [ 0 ] = dist } n , err := d . State . repLenCodec . Decode ( d . rd , posState ) if err != nil { return nil , err } d . State . updateStateRep ( ) op = match { n : int ( n ) + minMatchLen , distance : int64 ( dist ) + minDistance } return op , nil }
readOp decodes the next operation from the compressed stream.
readOp decodes the next operation from the compressed stream .
// Value of the end of stream (EOS) marker // literal // simple match // The length decoder returns the length offset. // The dist decoder returns the distance offset. The actual // distance is 1 higher. // rep match 0