code: func LZ4Compress(bytes []byte, out DataOutput, ht *LZ4HashTable) error {
  	offset, length := 0, len(bytes)
  	base, end := offset, offset+length
  
  	anchor := offset
  	offset++
  
  	if length > LAST_LITERALS+MIN_MATCH {
  		limit := end - LAST_LITERALS
  		matchLimit := limit - MIN_MATCH
  		ht.reset(length)
  		hashLog := ht.hashLog
  		hashTable := ht.hashTable
  
  		for offset <= limit {
  			// find a match
  			var ref int
  			var hasMore = offset < matchLimit
  			for hasMore {
  				v := readInt(bytes, offset)
  				h := hash(v, hashLog)
  				ref = base + int(hashTable.Get(h))
  				assert(packed.BitsRequired(int64(offset-base)) <= hashTable.BitsPerValue())
  				hashTable.Set(h, int64(offset-base))
  				if offset-ref < MAX_DISTANCE && readInt(bytes, ref) == v {
  					break
  				}
  				offset++
  				hasMore = offset < matchLimit
  			}
  			if !hasMore {
  				break
  			}
  
  			// compute match length
  			matchLen := MIN_MATCH + commonBytes(
  				bytes[ref+MIN_MATCH:limit],
  				bytes[offset+MIN_MATCH:limit])
  
  			err := encodeSequence(bytes[anchor:offset], offset-ref, matchLen, out)
  			if err != nil {
  				return err
  			}
  			offset += matchLen
  			anchor = offset
  		}
  	}
  
  	// last literals
  	literalLen := end - anchor
  	assert(literalLen >= LAST_LITERALS || literalLen == length)
  	return encodeLastLiterals(bytes[anchor:], out)
  }
docs: /*
  Compress bytes into out using at most 16KB of memory. ht shouldn't be
  shared across threads but can safely be reused.
  */