Example #1
0
        public static unsafe int Decode(byte *source, int sourceLength, byte *target, int targetLength)
        {
            if (sourceLength <= 0)
            {
                return(0);
            }

            int decoded = LZ4Engine.DecompressSafe(source, target, sourceLength, targetLength);

            return(decoded <= 0 ? -1 : decoded);
        }
Example #2
0
        private const byte CurrentVersion = 0 & VersionMask; // 3 bits

        /// <summary>
        /// Calculates the maximum size after compression.
        /// </summary>
        /// <param name="length">Length of input buffer.</param>
        /// <returns>
        /// Maximum length after compression.
        /// </returns>
        public static int MaximumOutputSize(int length)
        {
            return(LZ4Engine.CompressBound(length));
        }