+ This is the version using unrolled loops. +
+
+ var fname = "logfile.log.bz2";
+ using (var fs = File.OpenRead(fname))
+ {
+ using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs))
+ {
+ var outFname = fname + ".decompressed";
+ using (var output = File.Create(outFname))
+ {
+ byte[] buffer = new byte[2048];
+ int n;
+ while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ output.Write(buffer, 0, n);
+ }
+ }
+ }
+ }
+
+
+ var fname = "logfile.log";
+ using (var fs = File.OpenRead(fname))
+ {
+ var outFname = fname + ".bz2";
+ using (var output = File.Create(outFname))
+ {
+ using (var compressor = new Ionic.BZip2.BZip2OutputStream(output))
+ {
+ byte[] buffer = new byte[2048];
+ int n;
+ while ((n = fs.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ compressor.Write(buffer, 0, n);
+ }
+ }
+ }
+ }
+
+
+ var fname = "logfile.log";
+ using (var fs = File.OpenRead(fname))
+ {
+ var outFname = fname + ".bz2";
+ using (var output = File.Create(outFname))
+ {
+ using (var compressor = new Ionic.BZip2.ParallelBZip2OutputStream(output))
+ {
+ byte[] buffer = new byte[2048];
+ int n;
+ while ((n = fs.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ compressor.Write(buffer, 0, n);
+ }
+ }
+ }
+ }
+
+
+ (int)Floor((double)x/(double)y)
.(int)Floor((double)x/(double)y)
.x - (int)Floor((double)x/(double)y) * y
.x - (int)Floor((double)x/(double)y) * y
.