v 0. Pasted by Anonymous as cpp at 2011-04-04 16:05:02 MSK and set expiration to never.
v 1. Edited by Anonymous as cpp at 2011-04-05 22:01:09 MSK and set expiration to never.
v 2. Edited by Anonymous as cpp at 2011-04-09 11:59:19 MSK and set expiration to never.
v 3. Edited by wMFdHolHpyOgVTQBjI as cpp at 2012-03-22 10:08:34 MSK and set expiration to 2012-03-23 10:08:34 MSK.
v 4. Edited by Anonymous as cpp at 2012-03-22 10:08:35 MSK and set expiration to never.
v 5. Edited by qEzOjLPxodVj as cpp at 2012-03-22 12:47:25 MSK and set expiration to 2012-03-22 13:47:25 MSK.
v 6. Edited by Anonymous as cpp at 2012-03-22 12:47:26 MSK and set expiration to never.
v 7. Edited by zQluOWTsiUd as cpp at 2012-03-22 16:55:41 MSK and set expiration to 2012-03-23 16:55:41 MSK.
v 8. Edited by Anonymous as cpp at 2012-03-22 16:55:49 MSK and set expiration to never.
v 9. Edited by vZSwwblXBTKPOJdhwR as cpp at 2012-03-22 21:12:48 MSK and set expiration to 2012-03-23 21:12:48 MSK.
v 10. Edited by Anonymous as cpp at 2012-03-22 21:12:53 MSK and set expiration to never.
v 11. Edited by kHjuvxGSMirINMtncv as cpp at 2012-03-22 21:57:02 MSK and set expiration to 2012-03-23 03:57:02 MSK.
v 12. Edited by Anonymous as cpp at 2012-03-22 21:57:02 MSK and set expiration to never.
v 13. Edited by graPHyRTkcjYLdLdc as cpp at 2012-03-23 20:24:53 MSK and set expiration to 2012-03-23 21:24:53 MSK.
v 14. Edited by Anonymous as cpp at 2012-03-23 20:24:57 MSK and set expiration to never.
v 15. Edited by yAqRAPHqeKqUVc as cpp at 2012-03-24 04:59:26 MSK and set expiration to 2012-03-24 10:59:26 MSK.
v 16. Edited by Anonymous as cpp at 2012-03-24 04:59:29 MSK and set expiration to never.
v 17. Edited by xkGbvpUrNu as cpp at 2012-03-24 06:03:46 MSK and set expiration to 2012-03-24 07:03:46 MSK.
v 18. Edited by Anonymous as cpp at 2012-03-24 06:03:48 MSK and set expiration to never.
v 19. Edited by nCjAIvvaqqque as cpp at 2012-03-24 07:12:47 MSK and set expiration to 2012-03-24 13:12:47 MSK.
v 20. Edited by Anonymous as cpp at 2012-03-24 07:12:51 MSK and set expiration to never.
v 21. Edited by odGoCvpJRiouI as cpp at 2012-03-25 06:30:05 MSK and set expiration to 2012-03-25 07:30:05 MSK.
v 22. Edited by Anonymous as cpp at 2012-03-25 06:30:05 MSK and set expiration to never.
v 23. Reverted by Anonymous to version 2 at 2012-05-11 04:06:02 MSK.
v 24. Edited by BbLmusjVFRIzTSUUGlD as cpp at 2012-06-24 17:11:23 MSK and set expiration to 2012-06-25 05:11:23 MSK.
v 25. Edited by Anonymous as cpp at 2012-06-24 17:11:24 MSK and set expiration to never.
v 26. Edited by XxCRlZoK as cpp at 2012-08-20 08:26:32 MSK and set expiration to 2012-08-20 20:26:32 MSK.
v 27. Edited by Anonymous as cpp at 2012-08-20 08:26:33 MSK and set expiration to never.
v 28. Edited by VOyzTpMGBIcceUKFBd as cpp at 2014-02-14 15:54:27 MSK and set expiration to 2014-02-15 03:54:27 MSK.
v 29. Edited by Anonymous as cpp at 2014-02-14 15:54:30 MSK and set expiration to never.
v 30. Edited by dXrYCSBxAu as cpp at 2014-02-17 18:47:49 MSK and set expiration to 2014-02-17 19:47:49 MSK.
v 31. Edited by Anonymous as cpp at 2014-02-17 18:47:50 MSK and set expiration to never.
v 32. Edited by Anonymous as cpp at 2014-02-20 03:32:57 MSK and set expiration to 2014-02-20 04:32:57 MSK.
v 33. Edited by Anonymous as cpp at 2014-02-20 03:32:59 MSK and set expiration to never.
v 34. Edited by Anonymous as cpp at 2014-02-20 19:50:14 MSK and set expiration to 2014-02-21 19:50:14 MSK.
v 35. Edited by Anonymous as cpp at 2014-02-20 19:50:15 MSK and set expiration to never.
v 36. Edited by Anonymous as cpp at 2014-02-23 22:26:32 MSK and set expiration to 2014-02-24 22:26:32 MSK.
v 37. Edited by Anonymous as cpp at 2014-02-23 22:26:33 MSK and set expiration to never.
v 38. Edited by Anonymous as cpp at 2014-02-24 00:00:06 MSK and set expiration to 2014-02-25 00:00:06 MSK.
v 39. Edited by Anonymous as cpp at 2014-02-24 00:00:07 MSK and set expiration to never.
v 40. Edited by Anonymous as cpp at 2014-02-24 01:34:11 MSK and set expiration to 2014-02-24 13:34:11 MSK.
v 41. Edited by Anonymous as cpp at 2014-02-24 01:34:13 MSK and set expiration to never.
v 42. Edited by Anonymous as cpp at 2014-02-24 07:27:06 MSK and set expiration to 2014-02-24 19:27:06 MSK.
v 43. Edited by Anonymous as cpp at 2014-02-24 07:27:08 MSK and set expiration to never.
v 44. Edited by Anonymous as cpp at 2014-02-24 08:09:56 MSK and set expiration to 2014-02-25 08:09:56 MSK.
v 45. Edited by Anonymous as cpp at 2014-02-24 08:09:57 MSK and set expiration to never.
v 46. Edited by Anonymous as cpp at 2014-02-24 09:06:34 MSK and set expiration to 2014-02-25 09:06:34 MSK.
v 47. Edited by Anonymous as cpp at 2014-02-24 09:06:36 MSK and set expiration to never.
v 48. Edited by Anonymous as cpp at 2014-02-24 09:44:59 MSK and set expiration to 2014-02-24 15:44:59 MSK.
v 49. Edited by Anonymous as cpp at 2014-02-24 09:44:59 MSK and set expiration to never.
v 50. Edited by Anonymous as cpp at 2014-02-24 10:57:35 MSK and set expiration to 2014-02-24 22:57:35 MSK.
v 51. Edited by Anonymous as cpp at 2014-02-24 10:57:36 MSK and set expiration to never.
v 52. Edited by Anonymous as cpp at 2014-02-24 11:35:58 MSK and set expiration to 2014-02-24 23:35:58 MSK.
v 53. Edited by Anonymous as cpp at 2014-02-24 11:36:00 MSK and set expiration to never.
v 54. Edited by Anonymous as cpp at 2014-02-24 12:48:14 MSK and set expiration to 2014-02-24 18:48:14 MSK.
v 55. Edited by Anonymous as cpp at 2014-02-24 12:48:17 MSK and set expiration to never.
v 56. Edited by Anonymous as cpp at 2014-02-24 13:26:12 MSK and set expiration to 2014-02-24 19:26:12 MSK.
v 57. Edited by Anonymous as cpp at 2014-02-24 13:26:14 MSK and set expiration to never.
v 58. Edited by Anonymous as cpp at 2014-02-24 14:30:28 MSK and set expiration to 2014-02-24 20:30:28 MSK.
v 59. Edited by Anonymous as cpp at 2014-02-24 14:30:30 MSK and set expiration to never.
v 60. Edited by Anonymous as cpp at 2014-02-24 14:45:15 MSK and set expiration to 2014-02-24 15:45:15 MSK.
v 61. Edited by Anonymous as cpp at 2014-02-24 14:45:18 MSK and set expiration to never.
v 62. Edited by Anonymous as cpp at 2014-02-24 15:10:29 MSK and set expiration to 2014-02-24 16:10:29 MSK.
v 63. Edited by Anonymous as cpp at 2014-02-24 15:10:30 MSK and set expiration to never.
v 64. Edited by Anonymous as cpp at 2014-02-24 16:10:08 MSK and set expiration to 2014-02-24 22:10:08 MSK.
v 65. Edited by Anonymous as cpp at 2014-02-24 16:10:09 MSK and set expiration to never.
v 66. Edited by Anonymous as cpp at 2014-02-24 16:13:21 MSK and set expiration to 2014-02-25 04:13:21 MSK.
v 67. Edited by Anonymous as cpp at 2014-02-24 16:13:22 MSK and set expiration to never.
v 68. Edited by Anonymous as cpp at 2014-02-24 16:50:29 MSK and set expiration to 2014-02-25 16:50:29 MSK.
v 69. Edited by Anonymous as cpp at 2014-02-24 16:50:30 MSK and set expiration to never.
v 70. Edited by Anonymous as cpp at 2014-02-24 17:45:08 MSK and set expiration to 2014-02-24 23:45:08 MSK.
v 71. Edited by Anonymous as cpp at 2014-02-24 17:45:08 MSK and set expiration to never.
v 72. Edited by Anonymous as cpp at 2014-02-24 17:54:29 MSK and set expiration to 2014-02-24 23:54:29 MSK.
v 73. Edited by Anonymous as cpp at 2014-02-24 17:54:32 MSK and set expiration to never.
v 74. Edited by Anonymous as cpp at 2014-02-24 18:31:36 MSK and set expiration to 2014-02-25 06:31:36 MSK.
v 75. Edited by Anonymous as cpp at 2014-02-24 18:31:37 MSK and set expiration to never.
v 76. Edited by Anonymous as cpp at 2014-02-24 19:20:32 MSK and set expiration to 2014-02-25 19:20:32 MSK.
v 77. Edited by Anonymous as cpp at 2014-02-24 19:20:34 MSK and set expiration to never.
v 78. Edited by Anonymous as cpp at 2014-02-24 19:32:31 MSK and set expiration to 2014-02-25 07:32:31 MSK.
v 79. Edited by Anonymous as cpp at 2014-02-24 19:32:33 MSK and set expiration to never.
v 80. Edited by Anonymous as cpp at 2014-02-24 20:48:21 MSK and set expiration to 2014-02-25 20:48:21 MSK.
v 81. Edited by Anonymous as cpp at 2014-02-24 20:48:24 MSK and set expiration to never.
v 82. Edited by Anonymous as cpp at 2014-02-24 21:12:42 MSK and set expiration to 2014-02-25 21:12:42 MSK.
v 83. Edited by Anonymous as cpp at 2014-02-24 21:12:45 MSK and set expiration to never.
v 84. Edited by Anonymous as cpp at 2014-02-24 22:03:00 MSK and set expiration to 2014-02-25 10:03:00 MSK.
v 85. Edited by Anonymous as cpp at 2014-02-24 22:03:02 MSK and set expiration to never.
v 86. Edited by Anonymous as cpp at 2014-02-24 22:25:04 MSK and set expiration to 2014-02-24 23:25:04 MSK.
v 87. Edited by Anonymous as cpp at 2014-02-24 22:25:07 MSK and set expiration to never.
v 88. Edited by Anonymous as cpp at 2014-02-24 22:59:48 MSK and set expiration to 2014-02-25 04:59:48 MSK.
v 89. Edited by Anonymous as cpp at 2014-02-24 22:59:50 MSK and set expiration to never.
v 90. Edited by Anonymous as cpp at 2014-02-24 23:50:29 MSK and set expiration to 2014-02-25 23:50:29 MSK.
v 91. Edited by Anonymous as cpp at 2014-02-24 23:50:32 MSK and set expiration to never.
v 92. Edited by Anonymous as cpp at 2014-02-25 00:07:17 MSK and set expiration to 2014-02-25 01:07:17 MSK.
v 93. Edited by Anonymous as cpp at 2014-02-25 00:07:19 MSK and set expiration to never.
v 94. Edited by Anonymous as cpp at 2014-02-25 00:50:26 MSK and set expiration to 2014-02-25 12:50:26 MSK.
v 95. Edited by Anonymous as cpp at 2014-02-25 00:50:28 MSK and set expiration to never.
v 96. Edited by Anonymous as cpp at 2014-02-25 01:35:28 MSK and set expiration to 2014-02-25 13:35:28 MSK.
v 97. Edited by Anonymous as cpp at 2014-02-25 01:35:30 MSK and set expiration to never.
v 98. Edited by Anonymous as cpp at 2014-02-25 01:48:58 MSK and set expiration to 2014-02-25 02:48:58 MSK.
v 99. Edited by Anonymous as cpp at 2014-02-25 01:48:59 MSK and set expiration to never.
v 100. Reverted by Wraith to version 2 at 2014-03-22 02:35:54 MSK.
v 101. Reverted by TkjnjvrVlE to version 85 at 2016-08-20 07:44:16 MSK.
v 102. Reverted by bn7Ob6xcASO7 to version 4 at 2016-08-20 07:50:00 MSK.
v 103. Reverted by X0rZsCjk to version 99 at 2016-08-20 07:50:03 MSK.
v 104. Reverted by DzSafGhLbt to version 77 at 2016-08-20 07:52:08 MSK.
v 105. Reverted by ZI6nHkGJv to version 51 at 2016-08-20 07:53:28 MSK.
v 106. Reverted by 5mFqLg8Z to version 79 at 2016-08-20 07:55:05 MSK.
v 107. Reverted by XD4KE4DKl to version 22 at 2016-08-20 07:59:46 MSK.
v 108. Reverted by pi04SfgILxO to version 1 at 2016-08-20 08:00:38 MSK.
v 110. Reverted by K0E5GixzR to version 25 at 2016-08-20 08:12:10 MSK.
v 109. Reverted by pmEgTq4wCl3 to version 35 at 2016-08-20 08:12:10 MSK.
v 111. Reverted by DohVQXzQt to version 1 at 2016-08-20 08:15:48 MSK.
v 112. Reverted by 38U5viNo to version 104 at 2016-08-20 08:18:15 MSK.
v 113. Reverted by VBxFiA6Bwm to version 104 at 2016-08-20 08:19:33 MSK.
v 114. Reverted by XW8291IFFlv to version 100 at 2016-08-20 08:27:01 MSK.
v 115. Reverted by 5Mcl4l8XdAY to version 49 at 2016-08-20 08:42:35 MSK.
v 116. Reverted by JmStu4sm to version 112 at 2016-08-20 08:46:19 MSK.
v 117. Reverted by mdgVhbm4Fnr1 to version 2 at 2016-08-20 08:48:34 MSK.
v 118. Reverted by 9q3gz6aFWl to version 110 at 2016-08-20 08:53:19 MSK.
v 119. Reverted by jrVcWiYb to version 2 at 2016-08-20 08:58:05 MSK.
v 120. Reverted by 1W5EPYiq3R to version 18 at 2016-08-20 09:08:37 MSK.
v 121. Reverted by IJOmDeG7soH to version 23 at 2016-08-20 09:13:53 MSK.
v 122. Reverted by qxSkrSP7Ay7 to version 37 at 2016-08-20 09:14:58 MSK.
v 123. Reverted by HcxutJNGpjKd to version 93 at 2016-08-20 09:16:26 MSK.
v 124. Reverted by K8UDQfhjIpz to version 112 at 2016-08-20 09:23:19 MSK.
v 125. Reverted by TfoRWdLi0H to version 108 at 2016-08-20 09:27:53 MSK.
v 126. Reverted by vgE7mPLaPd to version 124 at 2016-08-20 09:36:11 MSK.
v 127. Reverted by cAS1gyai6 to version 79 at 2016-08-20 09:50:54 MSK.
v 128. Reverted by 2r0CLZnovp to version 107 at 2016-08-20 09:52:25 MSK.
v 129. Reverted by 6KjUDQu4 to version 10 at 2016-08-20 09:58:16 MSK.
v 130. Reverted by 5gtzTJzVW to version 83 at 2016-08-20 10:03:49 MSK.
v 131. Reverted by Qb0euNWfzHJ to version 4 at 2016-08-20 10:11:26 MSK.
v 132. Reverted by j6djaUWBgW to version 121 at 2016-08-20 11:02:13 MSK.
v 133. Reverted by SP4Uh4zLKB to version 110 at 2016-08-20 11:14:04 MSK.
v 134. Reverted by QJRrtdCFf3cu to version 108 at 2016-08-20 11:35:44 MSK.

Paste will expire never.

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <vector>
  4. #include <emmintrin.h>
  5. #include <memory.h>
  6. #include <time.h>
  7.  
  8. typedef unsigned char ui8;
  9. typedef unsigned short ui16;
  10. typedef unsigned int ui32;
  11. typedef unsigned long long ui64;
  12.  
  13. ui8 maps[32][16];
  14. size_t infos[256];
  15.  
  16. void inline Copy(const ui8 *data, ui8 *to) {
  17.     _mm_storeu_si128((__m128i *)(to), _mm_loadu_si128((const __m128i *)(data)));
  18. }
  19.  
  20. ui8 *UnCompress(const ui8 *data, const ui8 *end, ui8 *to) {
  21.     const ui8 *start = to;
  22.     while(data < end) {
  23.         size_t index = data[0];
  24.         if (index < 32) {
  25.             Copy(data + 1, to);
  26.             if (index > 15) {
  27.                 Copy(data + 17, to + 16);
  28.             }
  29.             to += index + 1;
  30.             data += index + 2;
  31.         } else {
  32.             size_t info = infos[index];
  33.             size_t length = info & 0x00ff;
  34.             size_t offset = (info & 0xff00) + size_t(data[1]);
  35.  
  36.             Copy(to - offset, to);
  37.             if (length > 16) {
  38.                 Copy(to - offset + 16, to + 16);
  39.             }
  40.             to += length;
  41.             data += 2;
  42.         }
  43.    }
  44.    return to;
  45. }
  46.  
  47. void FillTables() {
  48.  
  49.     memset(&maps[0][0], 0, sizeof(maps));
  50.     ui64 step = 1 << 16;
  51.  
  52.     for (size_t i = 0; i < 16; ++i) {
  53.         ui64 value = 65535;
  54.         step = (step * 67537) >> 16;
  55.         while(value < (29UL << 16)) {
  56.            maps[value >> 16][i] = 1;
  57.            value = (value * step) >> 16;
  58.         }
  59.     }
  60.  
  61.     int cntr = 0;
  62.     for (size_t i = 0; i < 29; ++i) {
  63.         for (size_t j = 0; j < 16; ++j) {
  64.             if (maps[i][j]) {
  65.                 infos[32 + cntr] = i + 4 + (j << 8);
  66.                 maps[i][j] = 32 + cntr;
  67.                 ++cntr;
  68.             } else {
  69.                 if (i == 0)
  70.                    throw("i == 0");
  71.                 maps[i][j] = maps[i - 1][j];
  72.             }
  73.         }
  74.     }
  75.     if (cntr != 256 - 32) {
  76.        throw("init error");
  77.     }
  78. }
  79.  
  80. int inline Match(const ui8 *data, size_t i, size_t j, size_t size) {
  81.     if (*(ui32 *)(data + i) != *(ui32 *)(data + j))
  82.         return 0;
  83.     size_t k = 4;
  84.     size_t bound = i - j;
  85.     bound = bound > size ? size : bound;
  86.     bound = bound > 32 ? 32 : bound;
  87.     for (;k < bound && data[i + k] == data[j + k]; ++k);
  88.     return k < bound ? k : bound;
  89. }
  90.  
  91.  
  92. ui64 inline Hash(ui64 value) {
  93.     return ((value * 912367421UL) >> 24) & 4095;
  94. }
  95.  
  96.  
  97. void inline Link(size_t *hashes, size_t *nodes, size_t i, const ui8 *data) {
  98.    size_t &hashValue = hashes[Hash(*(const ui32 *)(data + i))];
  99.    nodes[i & 4095] = hashValue;
  100.    hashValue = i;
  101. }
  102.  
  103.  
  104. ui8 *Compress(const ui8 *data, ui8 *to, size_t len, int level = 10) {
  105.  
  106.     size_t hashes[4096];
  107.     size_t nodes[4096];
  108.     ui8 end = 0xff;
  109.     ui8 *optr = &end;
  110.  
  111.     for (size_t i = 0; i < 4096; ++i) {
  112.         hashes[i] = size_t(-1);
  113.     }
  114.  
  115.     for (size_t i = 0; i < len;) {
  116.         ui8 coded = data[i];
  117.         Link(hashes, nodes, i, data);
  118.  
  119.         size_t bestMatch = 3;
  120.         ui16 bestCode = 0;
  121.  
  122.         size_t ptr = i;
  123.         int tries = 0;
  124.  
  125.         while(1) {
  126.             size_t newPtr = nodes[ptr & 4095];
  127.             if (newPtr >= ptr || i - newPtr >= 4095 || tries > level) {
  128.                 break;
  129.             }
  130.             ptr = newPtr;
  131.             size_t match = Match(data, i, ptr, len - i);
  132.  
  133.             if (bestMatch < match) {
  134.                 ui8 code = maps[match - 4][(i - ptr) >> 8];
  135.                 match = infos[code] & 0xff;
  136.  
  137.                 if (bestMatch < match) {
  138.                     bestMatch = match;
  139.                     bestCode = code + (((i - ptr) & 0xff) << 8);
  140.                     if (bestMatch == 32)
  141.                         break;
  142.                 }
  143.             }
  144.  
  145.             tries += match > 3;
  146.         }
  147.  
  148.         if (optr[0] > 30) {
  149.             optr = &end;
  150.         }
  151.  
  152.         if (bestMatch > 3) {
  153.             *(ui16 *)to = bestCode;
  154.  
  155.             for (size_t k = 1; k < bestMatch; ++k)
  156.                Link(hashes, nodes, i + k, data);
  157.  
  158.             i += bestMatch;
  159.             to += 2;
  160.             optr = &end;
  161.         } else {
  162.             if (optr[0] == 0xff) {
  163.                optr = to;
  164.                optr[0] = 0xff;
  165.                ++to;
  166.             }
  167.             ++optr[0];
  168.             to[0] = coded;
  169.             ++to;
  170.             ++i;
  171.         }
  172.     }
  173.     return to;
  174. }
  175.  
  176. std::vector<std::vector<ui8> > input;
  177. std::vector<std::vector<ui8> > output;
  178.  
  179. int main(int argc, const char *argv) {
  180.     try {
  181.         FillTables();
  182.     } catch(const char *ex) {
  183.         printf("exception \"%s\" during startup\n", ex);
  184.         return 3;
  185.     }
  186.     if (argc < 2) {
  187.         printf("usage: program <file name> [block size] [compression level]\n");
  188.         return 2;
  189.     }
  190.     FILE *fp = fopen(argv[1], "rb");
  191.     if (0 == fp) {
  192.         printf("can not open file %s for binary read\n", argv[1]);
  193.         return 1;
  194.     }
  195.     int cnt = 0;
  196.     float cl1 = clock();
  197.  
  198.     size_t size = 4096;
  199.     if (argc > 2) {
  200.         size = atoi(argv[2]);
  201.     }
  202.     int level = 10;
  203.     if (argc > 3) {
  204.         level = atoi(argv[3]);
  205.     }
  206.  
  207.     std::vector<ui8> out;
  208.     std::vector<ui8> chunk;
  209.     while(!feof(fp)) {
  210.         chunk.resize(size);
  211.         int num = fread(&chunk[0], 1, size, fp);
  212.         chunk.resize(num + 16);
  213.         out.resize(size * 2);
  214.         ui8 *compend = Compress(&chunk[0], &out[0], num, level);
  215.         out.resize(compend - &out[0] + 16);
  216.         input.push_back(out);
  217.         output.push_back(chunk);
  218.     }
  219.     fclose(fp);
  220.  
  221.     float cl2 = clock();
  222.     float ctime = (cl2 - cl1) / CLOCKS_PER_SEC;
  223.     float dtime = 0.0f;
  224.  
  225.     size_t usize = 0;
  226.     size_t csize = 0;
  227.     int cycles = 0;
  228.  
  229.     while(1) {
  230.         for (size_t i = 0; i < input.size(); ++i) {
  231.             ui8 *end = UnCompress(&input[i][0], &input[i][0] + input[i].size() - 16, &output[i][0]);
  232.             if (cycles == 0) {
  233.                 csize += input[i].size() - 16;
  234.                 usize += output[i].size() - 16;
  235.             }
  236.             if (output[i].size() - 16 != end - &output[i][0]) {
  237.                 printf("decompress failed\n");
  238.             }
  239.         }
  240.  
  241.         ++cycles;
  242.         float cl3 = clock();
  243.         dtime = (cl3 - cl2) / CLOCKS_PER_SEC;
  244.         if (dtime > 1.0f)
  245.             break;
  246.     }
  247.  
  248.  
  249.     printf("YAPPY: [b %dK] bytes %ld -> %ld %5.1f%%  comp %5.1f MB/s  uncomp %5.1f MB/s \n",
  250.         int(size / 1024),
  251.         usize,
  252.         csize,
  253.         float(csize) / float(usize) * 100.0f,
  254.         usize / ctime / 1024.0f / 1024.0f,
  255.         cycles * usize / dtime / 1024.0f / 1024.0f
  256.     );
  257.     return 0;
  258. }