Exemplo n.º 1
0
 /// <summary>Compresses the specified input.</summary>
 /// <param name="input">The input.</param>
 /// <param name="inputLength">Length of the input.</param>
 /// <param name="output">The output.</param>
 /// <param name="outputLength">Length of the output.</param>
 /// <returns>Status.</returns>
 public static unsafe SnappyStatus Compress(
     byte *input, int inputLength, byte *output, ref int outputLength)
 {
     if (IntPtr.Size == 4)
     {
         return(Snappy32.Compress(input, inputLength, output, ref outputLength));
     }
     else
     {
         long l      = outputLength;
         var  result = Snappy64.Compress(input, inputLength, output, ref l);
         // checked - exception here is better than just random errors later
         outputLength = checked ((int)l);
         return(result);
     }
 }