(strm, src, end, copy)
| 8753 | The advantage may be dependent on the size of the processor's data caches. |
| 8754 | */ |
| 8755 | function updatewindow(strm, src, end, copy) { |
| 8756 | var dist; |
| 8757 | var state = strm.state; |
| 8758 | |
| 8759 | /* if it hasn't been done already, allocate space for the window */ |
| 8760 | if (state.window === null) { |
| 8761 | state.wsize = 1 << state.wbits; |
| 8762 | state.wnext = 0; |
| 8763 | state.whave = 0; |
| 8764 | |
| 8765 | state.window = new utils.Buf8(state.wsize); |
| 8766 | } |
| 8767 | |
| 8768 | /* copy state->wsize or less output bytes into the circular window */ |
| 8769 | if (copy >= state.wsize) { |
| 8770 | utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); |
| 8771 | state.wnext = 0; |
| 8772 | state.whave = state.wsize; |
| 8773 | } |
| 8774 | else { |
| 8775 | dist = state.wsize - state.wnext; |
| 8776 | if (dist > copy) { |
| 8777 | dist = copy; |
| 8778 | } |
| 8779 | //zmemcpy(state->window + state->wnext, end - copy, dist); |
| 8780 | utils.arraySet(state.window, src, end - copy, dist, state.wnext); |
| 8781 | copy -= dist; |
| 8782 | if (copy) { |
| 8783 | //zmemcpy(state->window, end - copy, copy); |
| 8784 | utils.arraySet(state.window, src, end - copy, copy, 0); |
| 8785 | state.wnext = copy; |
| 8786 | state.whave = state.wsize; |
| 8787 | } |
| 8788 | else { |
| 8789 | state.wnext += dist; |
| 8790 | if (state.wnext === state.wsize) { state.wnext = 0; } |
| 8791 | if (state.whave < state.wsize) { state.whave += dist; } |
| 8792 | } |
| 8793 | } |
| 8794 | return 0; |
| 8795 | } |
| 8796 | |
| 8797 | function inflate(strm, flush) { |
| 8798 | var state; |
no outgoing calls
no test coverage detected