Rehash from old buffers to new buffers.
184888
protected void rehash(KType[] fromKeys, VType[] fromValues) {
    assert fromKeys.length == fromValues.length &&
           HashContainers.checkPowerOfTwo(fromKeys.length - 1);
    
    // Rehash all stored key/value pairs into the new buffers.
    final KType[] keys = Intrinsics.<KType[]> cast(this.keys);
    final VType[] values = Intrinsics.<VType[]> cast(this.values);
    final int mask = this.mask;
    KType existing;

    // Copy the zero element's slot, then rehash everything else.
    int from = fromKeys.length - 1;
    keys[keys.length - 1] = fromKeys[from];
    values[values.length - 1] = fromValues[from];
    while (--from >= 0) {
      if (!Intrinsics.<KType> isEmpty(existing = fromKeys[from])) {
        int slot = hashKey(existing) & mask;
        while (!Intrinsics.<KType> isEmpty(keys[slot])) {
          slot = (slot + 1) & mask;
        }
        keys[slot] = existing;
        values[slot] = fromValues[from];
      }
    }
  }
264725
def replace_blocks(self, blocks):
        """"""
        start = 0
        bulk_insert = self.bulk_insert
        blocks_len = len(blocks)
        row = '(%s,%s,%s,%s,%s)'
        query = 'REPLACE INTO gauged_data (namespace, offset, `key`, ' \
            'data, flags) VALUES '
        execute = self.cursor.execute
        to_buffer = self.to_buffer
        while start < blocks_len:
            rows = blocks[start:start+bulk_insert]
            params = []
            for namespace, offset, key, data, flags in rows:
                params.extend((namespace, offset, key, to_buffer(data), flags))
            insert = (row + ',') * (len(rows) - 1) + row
            execute(query + insert, params)
            start += bulk_insert
63024
def replace_multi(self, keys, ttl=0, format=None,
                      persist_to=0, replicate_to=0):
        
        return _Base.replace_multi(self, keys, ttl=ttl, format=format,
                                   persist_to=persist_to,
                                   replicate_to=replicate_to)
1250290
protected void rehash(final int newN) {
		int i = 0, pos;
		final VisitState[] visitState = this.visitState;
		final int newMask = newN - 1;
		final VisitState[] newVisitState = new VisitState[newN];

		for (int j = size; j-- != 0;) {
			while (visitState[i] == null) i++;
			VisitState v = visitState[i];
			pos = (int)(MurmurHash3.hash(v.schemeAuthority) & newMask);
			while (newVisitState[pos] != null) pos = (pos + 1) & newMask;
			newVisitState[pos] = v;
			i++;
		}
		n = newN;
		mask = newMask;
		maxFill = 3 * (n / 4);
		this.visitState = newVisitState;
	}
727538
def _update_buffers(self, from_step, data, offset, is_last):
        

        for to_step, buffer in self.target_buffers[from_step]:
            parent_index = 0

            # if there multiple inputs we have to get the correct index, to keep the ordering
            if isinstance(to_step, Reduction):
                parent_index = to_step.parents.index(from_step)

            buffer.update(data, offset, is_last, buffer_index=parent_index)
29344
def match_blocks(hash_func, old_children, new_children):
    """"""
    sm = difflib.SequenceMatcher(
        _is_junk,
        a=[hash_func(c) for c in old_children],
        b=[hash_func(c) for c in new_children],
    )
    return sm
786557
protected void rehash()
  {
    // do we need to increase capacity, or are there so many
    // deleted objects hanging around that rehashing to the same
    // size is sufficient? if 5% (arbitrarily chosen number) of
    // cells can be freed up by a rehash, we do it.

    int gargagecells = cells.length - (size + freecells);
    if ((double) gargagecells / cells.length > 0.05D)
    // rehash with same size
    {
      rehash(cells.length);
    } else
    // rehash with increased capacity
    {
      rehash((cells.length << 1) + 1);
    }
  }
1325535
def merge(self, buffer, other_hyper_log_log):
        

        for i in range(len(buffer)):
            buffer[i] = max(buffer[i], other_hyper_log_log[i])
1374702
private void moveBufferTo(byte[] dest) {
    int size = endIndex - index;
    System.arraycopy(buffer, index, dest, 0, size);
    index = 0;
    endIndex = size;
  }
1102227
def HashBuffer(self, buf):
    
    for hasher in itervalues(self._hashers):
      hasher.update(buf)
      if self._progress:
        self._progress()

    self._bytes_read += len(buf)
672225
def rehash(self):
        
        with self.lock:
            self.send('REHASH')
            if self.readable():
                msg = self._recv(expected_replies=('382',))
                if msg[0] == '382':
                    pass
1106778
function concatBulkBuffer (parser) {
  const list = parser.bufferCache
  const oldOffset = parser.offset
  const length = parser.bigStrSize - oldOffset - 2
  var chunks = list.length
  var offset = parser.bigStrSize - parser.totalChunkSize
  parser.offset = offset
  if (offset <= 2) {
    if (chunks === 2) {
      return list[0].slice(oldOffset, list[0].length + offset - 2)
    }
    chunks--
    offset = list[list.length - 2].length + offset
  }
  resizeBuffer(length)
  const start = bufferOffset
  list[0].copy(bufferPool, start, oldOffset, list[0].length)
  bufferOffset += list[0].length - oldOffset
  for (var i = 1; i < chunks - 1; i++) {
    list[i].copy(bufferPool, bufferOffset)
    bufferOffset += list[i].length
  }
  list[i].copy(bufferPool, bufferOffset, 0, offset - 2)
  bufferOffset += offset - 2
  return bufferPool.slice(start, bufferOffset)
}
1273383
public void flattenToBuffer(ByteBuffer buf) {
        ByteBuffer dup = m_buffer.duplicate();
        buf.putInt(dup.limit());
        dup.position(0);
        buf.put(dup);
    }
1206893
def rehash(path, blocksize=1 << 20):
    # type: (str, int) -> Tuple[str, str]
    """"""
    h = hashlib.sha256()
    length = 0
    with open(path, 'rb') as f:
        for block in read_chunks(f, size=blocksize):
            length += len(block)
            h.update(block)
    digest = 'sha256=' + urlsafe_b64encode(
        h.digest()
    ).decode('latin1').rstrip('=')
    # unicode/str python2 issues
    return (digest, str(length))
1292139
private static ByteBuffer copyAll(List<ByteBuffer> buffers) {
    int size = 0;
    for (ByteBuffer b : buffers) {
      size += b.remaining();
    }
    ByteBuffer result = allocate(size);
    for (ByteBuffer b : buffers) {
      result.put(b);
    }
    result.flip();
    return result;
  }
238797
def reset_local_buffers(self):
        
        agent_ids = list(self.keys())
        for k in agent_ids:
            self[k].reset_agent()
634985
def transform_streams_for_comparison(outputs):
    """"""
    new_outputs = []
    for output in outputs:
        if (output.output_type == 'stream'):
            # Transform output
            new_outputs.append({
                'output_type': 'stream',
                output.name: output.text,
            })
        else:
            new_outputs.append(output)
    return new_outputs