studio-RAWs.patch revision 6155
6155N/APatch origin: in-house
6155N/APatch status: Solaris-specific; not suitable for upstream
6155N/A
6155N/A--- zlib-1.2.8/inflate.c
6155N/A+++ zlib-1.2.8/inflate.c
6155N/A@@ -976,8 +976,15 @@ int flush;
6155N/A state->mode = BAD;
6155N/A break;
6155N/A }
6155N/A- while (copy--)
6155N/A- state->lens[state->have++] = (unsigned short)len;
6155N/A+ //while (copy--)
6155N/A+ // state->lens[state->have++] = (unsigned short)len;
6155N/A+
6155N/A+ unsigned state_have=state->have; // Make local copy of state->have to eliminate RAW
6155N/A+ // Change from while to for loop and make local copy of "copy" so it can be unrolled:
6155N/A+ for (unsigned copy_copy=copy; copy_copy>0; copy_copy--, (state_have)++) {
6155N/A+ state->lens[state_have] = (unsigned short)len;
6155N/A+ }
6155N/A+ state->have = state_have; // Copy back value
6155N/A }
6155N/A }
6155N/A
6155N/A--- zlib-1.2.8/inftrees.c
6155N/A+++ zlib-1.2.8/inftrees.c
6155N/A@@ -230,12 +230,22 @@
6155N/A }
6155N/A
6155N/A /* replicate for those indices with low len bits equal to huff */
6155N/A+ // KPG: Create local variables so the compiler won't access via a pointer
6155N/A+ unsigned char op_copy = here.op;
6155N/A+ unsigned char bits_copy = here.bits;
6155N/A+ unsigned short val_copy = here.val;
6155N/A+
6155N/A incr = 1U << (len - drop);
6155N/A fill = 1U << curr;
6155N/A min = fill; /* save offset to next table */
6155N/A do {
6155N/A fill -= incr;
6155N/A- next[(huff >> drop) + fill] = here;
6155N/A+ //next[(huff >> drop) + fill] = here; // RAW read
6155N/A+
6155N/A+ // Instead of the above, storing individual elements eliminates RAW:
6155N/A+ next[(huff >> drop) + fill].op = op_copy;
6155N/A+ next[(huff >> drop) + fill].bits = bits_copy;
6155N/A+ next[(huff >> drop) + fill].val = val_copy;
6155N/A } while (fill != 0);
6155N/A
6155N/A /* backwards increment the len-bit code huff */