lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Fill the window when the lookahead becomes insufficient.
# Updates strstart and lookahead.
#
# IN assertion: lookahead < MIN_LOOKAHEAD
# OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
#    At least one byte has been read, or avail_in == 0; reads are
#    performed for at least two bytes (required for the zip translate_eol
#    option -- not supported here).
Fill the window when the lookahead becomes insufficient.
Updates strstart and lookahead.

IN assertion: lookahead < MIN_LOOKAHEAD
OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
At least one byte has been read, or avail_in == 0; reads are
performed for at least two bytes (required for the zip translate_eol
option -- not supported here).
Fill the window when the lookahead becomes insufficient . Updates strstart and lookahead . IN assertion : lookahead < MIN_LOOKAHEAD OUT assertions : strstart < = window_size - MIN_LOOKAHEAD At least one byte has been read or avail_in == 0 ; reads are performed for at least two bytes ( required for the zip translate_eol option -- not supported here ) .
def fill_window(s)
    wsize = s.w_size
    loop do
      more = s.window_size - s.lookahead - s.strstart
      if more == 0 && s.strstart == 0 && s.lookahead == 0
        more = wsize
      elsif (more == (-1))
          more -= 1
      end
      if (s.strstart >= wsize+ (wsize-MIN_LOOKAHEAD))
        s.window[0,wsize] = s.window[wsize,wsize]
        s.match_start -= wsize
        s.strstart -= wsize
        s.block_start -= wsize
        n = s.hash_size
        ap = n
        loop do
          ap -= 1
          m = s.head[ap]
          if (m >= wsize)
            s.head[ap] = m-wsize
          else
            s.head[ap] = ZNIL
          end
          n -= 1
          break if n == 0
        end
        n = wsize
        ap = n
        loop do
          ap-=1
          m = s.prev[ap]
          if (m >= wsize)
            s.prev[ap] = (m-wsize)
          else
            s.prev[ap] = ZNIL
          end
          n-=1
          break if n == 0
        end
        more += wsize
      end
      return if s.strm.avail_in == 0
      n = read_buf(s.strm, s.window,(s.strstart + s.lookahead),more)
      s.lookahead += n
      if (s.lookahead >= MIN_MATCH)
        s.ins_h = s.window[s.strstart].ord
        s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart+1].ord) & s.hash_mask
      end
      break if (s.lookahead >= MIN_LOOKAHEAD) || s.strm.avail_in == 0
    end
  end
def fill_window ( s ) wsize = s . w_size loop do more = s . window_size - s . lookahead - s . strstart if more == 0 && s . strstart == 0 && s . lookahead == 0 more = wsize elsif ( more == ( - 1 ) ) more -= 1 end if ( s . strstart >= wsize + ( wsize - MIN_LOOKAHEAD ) ) s . window [ 0 , wsize ] = s . window [ wsize , wsize ] s . match_start -= wsize s . strstart -= wsize s . block_start -= wsize n = s . hash_size ap = n loop do ap -= 1 m = s . head [ ap ] if ( m >= wsize ) s . head [ ap ] = m - wsize else s . head [ ap ] = ZNIL end n -= 1 break if n == 0 end n = wsize ap = n loop do ap -= 1 m = s . prev [ ap ] if ( m >= wsize ) s . prev [ ap ] = ( m - wsize ) else s . prev [ ap ] = ZNIL end n -= 1 break if n == 0 end more += wsize end return if s . strm . avail_in == 0 n = read_buf ( s . strm , s . window , ( s . strstart + s . lookahead ) , more ) s . lookahead += n if ( s . lookahead >= MIN_MATCH ) s . ins_h = s . window [ s . strstart ] . ord s . ins_h = ( ( s . ins_h << s . hash_shift ) ^ s . window [ s . strstart + 1 ] . ord ) & s . hash_mask end break if ( s . lookahead >= MIN_LOOKAHEAD ) || s . strm . avail_in == 0 end end
Fill the window when the lookahead becomes insufficient.
Fill the window when the lookahead becomes insufficient .
s
<not_specific>