@@ -26,16 +26,16 @@ public void Setup()
2626 Console . WriteLine ( $ "Zlib-ng version: { _zlibng . GetVersionString ( ) } ") ;
2727
2828 const int count = 4_000_00 ;
29- var randomBuffer = new byte [ count * sizeof ( long ) ] ; // 3.2 MB
29+ byte [ ] randomBuffer = new byte [ count * sizeof ( long ) ] ; // 3.2 MB
3030 var random = new Random ( 187 ) ;
31- for ( var i = 0 ; i < count ; i += sizeof ( long ) )
31+ for ( int i = 0 ; i < count ; i += sizeof ( long ) )
3232 {
3333 Unsafe . WriteUnaligned ( ref randomBuffer [ i ] , random . NextInt64 ( 0 , 69 ) ) ;
3434 }
35- var compressionBound = ( int ) _zlibng . CompressBound ( randomBuffer . Length ) ;
36- var tmpBuffer = ArrayPool < byte > . Shared . Rent ( compressionBound ) ;
37- var compressedSize = ( uint ) _zlibng . Compress2 ( tmpBuffer . AsSpan ( 0 , compressionBound ) , randomBuffer , ZlibngCompressionLevel . Best ) ;
38- var compressionRatio = ( double ) randomBuffer . Length / compressedSize ;
35+ int compressionBound = ( int ) _zlibng . CompressBound ( randomBuffer . Length ) ;
36+ byte [ ] tmpBuffer = ArrayPool < byte > . Shared . Rent ( compressionBound ) ;
37+ uint compressedSize = ( uint ) _zlibng . Compress2 ( tmpBuffer . AsSpan ( 0 , compressionBound ) , randomBuffer , ZlibngCompressionLevel . Best ) ;
38+ double compressionRatio = ( double ) randomBuffer . Length / compressedSize ;
3939 Console . WriteLine ( "Compression ratio: {0}" , compressionRatio . ToString ( "0.000" , CultureInfo . InvariantCulture ) ) ;
4040 _destBuffer = randomBuffer ;
4141 _srcBuffer = new byte [ compressedSize ] ;
@@ -81,7 +81,7 @@ public static int Uncompress_SharpZipLib_Inflater(byte[] dest, byte[] src)
8181 {
8282 var inflater = new ICSharpCode . SharpZipLib . Zip . Compression . Inflater ( ) ;
8383 inflater . SetInput ( src ) ;
84- var result = inflater . Inflate ( dest ) ;
84+ int result = inflater . Inflate ( dest ) ;
8585 return result ;
8686 }
8787
@@ -103,7 +103,7 @@ public static int Uncompress_DotnetZip_ZlibCodec(byte[] dest, byte[] src)
103103 AvailableBytesIn = src . Length ,
104104 AvailableBytesOut = dest . Length
105105 } ;
106- var result = codec . Inflate ( Ionic . Zlib . FlushType . Full ) ;
106+ int result = codec . Inflate ( Ionic . Zlib . FlushType . Full ) ;
107107 return result ;
108108 }
109109
0 commit comments