lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Update the window with the last wsize (normally 32K) bytes written before
# returning.  If window does not exist yet, create it.  This is only called
# when a window is already in use, or when output has been written during this
# inflate call, but the end of the deflate stream has not been reached yet.
# It is also called to create a window for dictionary data when a dictionary
# is loaded.
#
# Providing output buffers larger than 32K to inflate() should provide a speed
# advantage, since only the last 32K of output is copied to the sliding window
# upon return from inflate(), and since all distances after the first 32K of
# output will fall in the output data, making match copies simpler and faster.
# The advantage may be dependent on the size of the processor's data caches.
Update the window with the last wsize (normally 32K) bytes written before
returning.  If window does not exist yet, create it.  This is only called
when a window is already in use, or when output has been written during this
inflate call, but the end of the deflate stream has not been reached yet.
It is also called to create a window for dictionary data when a dictionary
is loaded.

Providing output buffers larger than 32K to inflate() should provide a speed
advantage, since only the last 32K of output is copied to the sliding window
upon return from inflate(), and since all distances after the first 32K of
output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches.
Update the window with the last wsize ( normally 32K ) bytes written before returning . If window does not exist yet create it . This is only called when a window is already in use or when output has been written during this inflate call but the end of the deflate stream has not been reached yet . It is also called to create a window for dictionary data when a dictionary is loaded . Providing output buffers larger than 32K to inflate () should provide a speed advantage since only the last 32K of output is copied to the sliding window upon return from inflate () and since all distances after the first 32K of output will fall in the output data making match copies simpler and faster . The advantage may be dependent on the size of the processor ' s data caches .
def updatewindow(strm, out)
    state = strm.state
    if state.window.nil?
        state.window = 0.chr * (1 << state.wbits)
        return true if state.window.nil?
    end
    if state.wsize == 0
        state.wsize = 1 << state.wbits
        state.write = 0
        state.whave = 0
    end
    copy = out - strm.avail_out
    if (copy >= state.wsize)
        state.window[0,state.wsize] =
          strm.next_out.buffer[strm.next_out.offset-state.wsize,state.wsize]
        state.write = 0
        state.whave = state.wsize
    else
        dist = state.wsize - state.write
        dist = copy if (dist > copy)
        state.window[state.write,dist] =
          strm.next_out.buffer[strm.next_out.offset-copy,dist]
        copy -= dist
        if copy != 0
            state.window[0,copy] =
              strm.next_out.buffer[strm.next_out.offset-copy,copy]
            state.write = copy
            state.whave = state.wsize
        else
            state.write += dist
            state.write = 0 if (state.write == state.wsize)
            state.whave += dist if (state.whave < state.wsize)
        end
    end
    return false
  end
def updatewindow ( strm , out ) state = strm . state if state . window . nil? state . window = 0 . chr * ( 1 << state . wbits ) return true if state . window . nil? end if state . wsize == 0 state . wsize = 1 << state . wbits state . write = 0 state . whave = 0 end copy = out - strm . avail_out if ( copy >= state . wsize ) state . window [ 0 , state . wsize ] = strm . next_out . buffer [ strm . next_out . offset - state . wsize , state . wsize ] state . write = 0 state . whave = state . wsize else dist = state . wsize - state . write dist = copy if ( dist > copy ) state . window [ state . write , dist ] = strm . next_out . buffer [ strm . next_out . offset - copy , dist ] copy -= dist if copy != 0 state . window [ 0 , copy ] = strm . next_out . buffer [ strm . next_out . offset - copy , copy ] state . write = copy state . whave = state . wsize else state . write += dist state . write = 0 if ( state . write == state . wsize ) state . whave += dist if ( state . whave < state . wsize ) end end return false end
Update the window with the last wsize (normally 32K) bytes written before
returning.
Update the window with the last wsize ( normally 32K ) bytes written before returning .
strm
<not_specific>
out
<not_specific>