public void Complete()
        {
            if (_state == FseCompressorState.Completed)
            {
                return;
            }

            if (_state == FseCompressorState.NeedInput)
            {
                Compress();
            }

            _state = FseCompressorState.WriteOutput;
            Debug.Assert(_outputBuffer != null);

            uint checksum = _hash.GetFinalHash();

            checksum = (checksum >> 5) & ((1u << 22) - 1);

            Span <byte> block = _outputBuffer.AsSpan(_outputOffset + _bytesGenerated);

            block[2] = (byte)checksum;
            block[1] = (byte)(checksum >> 8);
            block[0] = (byte)((checksum >> 16) + (0b11 << 6));

            _bytesGenerated += 3;
            _headerWritten   = false;
            _hash            = XxHash32.Initialize();
        }
        public void Reset()
        {
            _state         = FseCompressorState.NeedInput;
            _headerWritten = false;
            _hash          = XxHash32.Initialize();

            _bytesRead      = 0;
            _outputOffset   = 0;
            _bytesGenerated = 0;
        }