Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. Date: Mon, 28 Aug 1995 23:53:23 CET +0100
  2. From: "Christian Spieler, Institut fuer Kernphysik, Schlossgartenstr. 9,
  3.       D-64289 Darmstadt" <SPIELER@linac.ikp.physik.th-darmstadt.de>
  4. Subject: More MSC 5.1 related patches for UnZip 5.20f2
  5.  
  6.  
  7. D) I want to suggest two small patches to allow the use of
  8.    full optimization (including loop optimization) when compiling UnZip
  9.    with MSC (5.1, and probably newer). There are only two small pieces
  10.    of code (containing to deeply nested loops) that break MSC 5.1's loop
  11.    optimization. I have guarded these loops with "#pragma loop_opt (off)"
  12.    to allow loop optimization for the rest of the code. Here are the patches:
  13.  
  14. ===================== cut here ========================
  15. diff -c ./inflate.c ./modif/inflate.c
  16. *** ./inflate.c Thu Oct 05 14:57:38 1995
  17. --- ./modif/inflate.c   Thu Oct 05 14:58:24 1995
  18. ***************
  19. *** 1162,1173 ****
  20. --- 1162,1179 ----
  21.           {                       /* too few codes for k-w bit table */
  22.             f -= a + 1;           /* deduct codes from patterns left */
  23.             xp = c + k;
  24. + #if defined (MSC)
  25. + #pragma loop_opt (off)
  26. + #endif /* MS C compilers */
  27.             while (++j < z)       /* try smaller tables up to z bits */
  28.             {
  29.               if ((f <<= 1) <= *++xp)
  30.                 break;            /* enough codes to use up j bits */
  31.               f -= *xp;           /* else deduct codes from patterns */
  32.             }
  33. + #if defined (MSC)
  34. + #pragma loop_opt ()
  35. + #endif /* MS C compilers */
  36.           }
  37.           if ((unsigned)w + j > el && (unsigned)w < el)
  38.             j = el - w;           /* make EOB code end at table */
  39. diff -c ./zipinfo.c ./modif/zipinfo.c
  40. *** ./zipinfo.c Thu Oct 05 14:51:58 1995
  41. --- ./modif/zipinfo.c   Thu Oct 05 14:52:42 1995
  42. ***************
  43. *** 1134,1145 ****
  44. --- 1134,1151 ----
  45.                       workspace[10] = 'E';
  46.  
  47.                   p = attribs;
  48. + #if defined (MSC) && (!defined (_MSC_VER) || _MSC_VER < 600)
  49. + #pragma loop_opt (off)
  50. + #endif /* MS C, Version < 6.00 */
  51.                   for (k = j = 0;  j < 3;  ++j) {     /* groups of permissions */
  52.                       for (i = 0;  i < 4;  ++i, ++k)  /* perms within a group */
  53.                           if (workspace[k])
  54.                               *p++ = workspace[k];
  55.                       *p++ = ',';                     /* group separator */
  56.                   }
  57. + #if defined (MSC) && (!defined (_MSC_VER) || _MSC_VER < 600)
  58. + #pragma loop_opt ()
  59. + #endif /* MS C, Version < 6.00 */
  60.                   *--p = ' ';   /* overwrite last comma */
  61.                   if ((p - attribs) < 12)
  62.                       sprintf(&attribs[12], "%d.%d", hostver/10, hostver%10);
  63.