components/zlib/patches/perf.patch
changeset 825 78809aba88fe
child 1945 3dc1935a2189
equal deleted inserted replaced
824:3c0f8247e0cd 825:78809aba88fe
       
     1 --- zlib-1.2.3/zlib.h.orig   Sun Jul 17 19:26:49 2005
       
     2 +++ zlib-1.2.3/zlib.h        Tue May 22 10:17:54 2012
       
     3 @@ -37,8 +37,8 @@
       
     4  extern "C" {
       
     5  #endif
       
     6  
       
     7 -#define ZLIB_VERSION "1.2.3"
       
     8 -#define ZLIB_VERNUM 0x1230
       
     9 +#define ZLIB_VERSION "1.2.3-T4mods"
       
    10 +#define ZLIB_VERNUM 0x123f
       
    11  
       
    12  /*
       
    13       The 'zlib' compression library provides in-memory compression and
       
    14 --- zlib-1.2.3/Makefile.in.orig	Mon May 14 14:29:35 2012
       
    15 +++ zlib-1.2.3/Makefile.in	Mon May 14 14:30:29 2012
       
    16 @@ -77,8 +77,8 @@
       
    17  	mv _match.o match.o
       
    18  	rm -f _match.s
       
    19  
       
    20 -$(SHAREDLIBV): $(OBJS)
       
    21 -	$(LDSHARED) -o $@ $(OBJS)
       
    22 +$(SHAREDLIBV): $(OBJS) $(PIC_OBJS)
       
    23 +	$(LDSHARED) -o $@ $(OBJS) $(PIC_OBJS)
       
    24  	rm -f $(SHAREDLIB) $(SHAREDLIBM)
       
    25  	ln -s $@ $(SHAREDLIB)
       
    26  	ln -s $@ $(SHAREDLIBM)
       
    27 
       
    28 --- zlib-1.2.3/inffast.c.orig	Fri Nov 12 22:05:29 2004
       
    29 +++ zlib-1.2.3/inffast.c	Tue Mar 27 08:05:36 2012
       
    30 @@ -87,7 +87,7 @@
       
    31      code const FAR *dcode;      /* local strm->distcode */
       
    32      unsigned lmask;             /* mask for first level of length codes */
       
    33      unsigned dmask;             /* mask for first level of distance codes */
       
    34 -    code this;                  /* retrieved table entry */
       
    35 +    code *this;                 /* retrieved table entry */
       
    36      unsigned op;                /* code bits, operation, extra bits, or */
       
    37                                  /*  window position, window bytes to copy */
       
    38      unsigned len;               /* match length, unused bytes */
       
    39 @@ -124,20 +124,20 @@
       
    40              hold += (unsigned long)(PUP(in)) << bits;
       
    41              bits += 8;
       
    42          }
       
    43 -        this = lcode[hold & lmask];
       
    44 +        this = (code *)(&(lcode[hold & lmask]));
       
    45        dolen:
       
    46 -        op = (unsigned)(this.bits);
       
    47 +        op = (unsigned)(this->bits);
       
    48          hold >>= op;
       
    49          bits -= op;
       
    50 -        op = (unsigned)(this.op);
       
    51 +        op = (unsigned)(this->op);
       
    52          if (op == 0) {                          /* literal */
       
    53 -            Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
       
    54 +            Tracevv((stderr, this->val >= 0x20 && this->val < 0x7f ?
       
    55                      "inflate:         literal '%c'\n" :
       
    56 -                    "inflate:         literal 0x%02x\n", this.val));
       
    57 -            PUP(out) = (unsigned char)(this.val);
       
    58 +                    "inflate:         literal 0x%02x\n", this->val));
       
    59 +            PUP(out) = (unsigned char)(this->val);
       
    60          }
       
    61          else if (op & 16) {                     /* length base */
       
    62 -            len = (unsigned)(this.val);
       
    63 +            len = (unsigned)(this->val);
       
    64              op &= 15;                           /* number of extra bits */
       
    65              if (op) {
       
    66                  if (bits < op) {
       
    67 @@ -155,14 +155,14 @@
       
    68                  hold += (unsigned long)(PUP(in)) << bits;
       
    69                  bits += 8;
       
    70              }
       
    71 -            this = dcode[hold & dmask];
       
    72 +            this = (code *)(&(dcode[hold & dmask]));
       
    73            dodist:
       
    74 -            op = (unsigned)(this.bits);
       
    75 +            op = (unsigned)(this->bits);
       
    76              hold >>= op;
       
    77              bits -= op;
       
    78 -            op = (unsigned)(this.op);
       
    79 +            op = (unsigned)(this->op);
       
    80              if (op & 16) {                      /* distance base */
       
    81 -                dist = (unsigned)(this.val);
       
    82 +                dist = (unsigned)(this->val);
       
    83                  op &= 15;                       /* number of extra bits */
       
    84                  if (bits < op) {
       
    85                      hold += (unsigned long)(PUP(in)) << bits;
       
    86 @@ -259,7 +259,8 @@
       
    87                  }
       
    88              }
       
    89              else if ((op & 64) == 0) {          /* 2nd level distance code */
       
    90 -                this = dcode[this.val + (hold & ((1U << op) - 1))];
       
    91 +                this = (code *)
       
    92 +		    (&(dcode[this->val + (hold & ((1U << op) - 1))]));
       
    93                  goto dodist;
       
    94              }
       
    95              else {
       
    96 @@ -269,7 +270,7 @@
       
    97              }
       
    98          }
       
    99          else if ((op & 64) == 0) {              /* 2nd level length code */
       
   100 -            this = lcode[this.val + (hold & ((1U << op) - 1))];
       
   101 +            this = (code *)(&(lcode[this->val + (hold & ((1U << op) - 1))]));
       
   102              goto dolen;
       
   103          }
       
   104          else if (op & 32) {                     /* end-of-block */
       
   105 
       
   106 --- zlib-1.2.3/deflate.c.orig   Tue Mar 27 10:02:52 2012
       
   107 +++ zlib-1.2.3/deflate.c        Sun Jul 17 19:27:31 2005
       
   108 @@ -88,9 +88,13 @@
       
   109        void match_init OF((void)); /* asm code initialization */
       
   110        uInt longest_match  OF((deflate_state *s, IPos cur_match));
       
   111  #else
       
   112 +#ifdef ORIG_LONGEST_MATCH
       
   113  local uInt longest_match  OF((deflate_state *s, IPos cur_match));
       
   114 +#else
       
   115 +uInt longest_match  OF((deflate_state *s, IPos cur_match));
       
   116  #endif
       
   117  #endif
       
   118 +#endif
       
   119  local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
       
   120  
       
   121  #ifdef DEBUG
       
   122 @@ -1010,6 +1014,7 @@
       
   123  #endif
       
   124  }
       
   125  
       
   126 +#if defined(ORIG_LONGEST_MATCH) || defined(ORIG_LONGEST_MATCH_GLOBAL)
       
   127  #ifndef FASTEST
       
   128  /* ===========================================================================
       
   129   * Set match_start to the longest match starting at the given string and
       
   130 @@ -1024,7 +1029,11 @@
       
   131  /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
       
   132   * match.S. The code will be functionally equivalent.
       
   133   */
       
   134 +#ifdef ORIG_LONGEST_MATCH_GLOBAL
       
   135 +uInt longest_match(s, cur_match)
       
   136 +#else
       
   137  local uInt longest_match(s, cur_match)
       
   138 +#endif
       
   139      deflate_state *s;
       
   140      IPos cur_match;                             /* current match */
       
   141  {
       
   142 @@ -1168,6 +1177,7 @@
       
   143  }
       
   144  #endif /* ASMV */
       
   145  #endif /* FASTEST */
       
   146 +#endif /* ORIG_LONGEST_MATCHT */
       
   147  
       
   148  /* ---------------------------------------------------------------------------
       
   149   * Optimized version for level == 1 or strategy == Z_RLE only