code: func (z *Writer) compressBlock(data []byte) error {
  	if !z.NoChecksum {
  		z.checksum.Write(data)
  	}
  
  	// The compressed block size cannot exceed the input's.
  	var zn int
  	var err error
  
  	if level := z.Header.CompressionLevel; level != 0 {
  		zn, err = CompressBlockHC(data, z.zdata, level)
  	} else {
  		zn, err = CompressBlock(data, z.zdata, z.hashtable[:])
  	}
  
  	var zdata []byte
  	var bLen uint32
  	if debugFlag {
  		debug("block compression %d => %d", len(data), zn)
  	}
  	if err == nil && zn > 0 && zn < len(data) {
  		// Compressible and compressed size smaller than uncompressed: ok!
  		bLen = uint32(zn)
  		zdata = z.zdata[:zn]
  	} else {
  		// Uncompressed block.
  		bLen = uint32(len(data)) | compressedBlockFlag
  		zdata = data
  	}
  	if debugFlag {
  		debug("block compression to be written len=%d data len=%d", bLen, len(zdata))
  	}
  
  	// Write the block.
  	if err := z.writeUint32(bLen); err != nil {
  		return err
  	}
  	written, err := z.dst.Write(zdata)
  	if err != nil {
  		return err
  	}
  	if h := z.OnBlockDone; h != nil {
  		h(written)
  	}
  
  	if z.BlockChecksum {
  		checksum := xxh32.ChecksumZero(zdata)
  		if debugFlag {
  			debug("block checksum %x", checksum)
  		}
  		if err := z.writeUint32(checksum); err != nil {
  			return err
  		}
  	}
  	if debugFlag {
  		debug("current frame checksum %x", z.checksum.Sum32())
  	}
  
  	return nil
  }
docs: // compressBlock compresses a block.