_commitVertexBuffers
339809
function (device, gl, cur, next) {
  let attrsDirty = false;

  // nothing changed for vertex buffer
  if (next.maxStream === -1) {
    console.warn('VertexBuffer not assigned, please call setVertexBuffer before every draw.');
    return;
  }

  if (cur.maxStream !== next.maxStream) {
    attrsDirty = true;
  } else if (cur.program !== next.program) {
    attrsDirty = true;
  } else {
    for (let i = 0; i < next.maxStream + 1; ++i) {
      if (
        cur.vertexBuffers[i] !== next.vertexBuffers[i] ||
        cur.vertexBufferOffsets[i] !== next.vertexBufferOffsets[i]
      ) {
        attrsDirty = true;
        break;
      }
    }
  }

  if (attrsDirty) {
    for (let i = 0; i < device._caps.maxVertexAttribs; ++i) {
      device._newAttributes[i] = 0;
    }

    for (let i = 0; i < next.maxStream + 1; ++i) {
      let vb = next.vertexBuffers[i];
      let vbOffset = next.vertexBufferOffsets[i];
      if (!vb) {
        continue;
      }

      gl.bindBuffer(gl.ARRAY_BUFFER, vb._glID);

      for (let j = 0; j < next.program._attributes.length; ++j) {
        let attr = next.program._attributes[j];

        let el = vb._format.element(attr.name);
        if (!el) {
          console.warn(`Can not find vertex attribute: ${attr.name}`);
          continue;
        }

        if (device._enabledAttributes[attr.location] === 0) {
          gl.enableVertexAttribArray(attr.location);
          device._enabledAttributes[attr.location] = 1;
        }
        device._newAttributes[attr.location] = 1;

        gl.vertexAttribPointer(
          attr.location,
          el.num,
          el.type,
          el.normalize,
          el.stride,
          el.offset + vbOffset * el.stride
        );
      }
    }

    // disable unused attributes
    for (let i = 0; i < device._caps.maxVertexAttribs; ++i) {
      if (device._enabledAttributes[i] !== device._newAttributes[i]) {
        gl.disableVertexAttribArray(i);
        device._enabledAttributes[i] = 0;
      }
    }
  }
}
793461
function amf0encDate(ts) {
    var buf = new Buffer(11);
    buf.writeUInt8(0x0B, 0);
    buf.writeInt16BE(0, 1);
    buf.writeDoubleBE(ts, 3);
    return buf;
}
108320
async function commitVersionBump (version) {
  const gitDir = path.resolve(__dirname, '..')
  const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
  await GitProcess.exec(gitArgs, gitDir)
}
932497
function amf0encRef(index) {
    var buf = new Buffer(3);
    buf.writeUInt8(0x07, 0);
    buf.writeUInt16BE(index, 1);
    return buf;
}
308840
function decodeBufferCommon(encodedBuffer, index, signed) {
  index = index === undefined ? 0 : index;

  let length = encodedLength(encodedBuffer, index);
  const bitLength = length * 7;
  let byteLength = Math.ceil(bitLength / 8);
  let result = bufs.alloc(byteLength);
  let outIndex = 0;

  while (length > 0) {
    bits.inject(result, outIndex, 7, encodedBuffer[index]);
    outIndex += 7;
    index++;
    length--;
  }

  let signBit;
  let signByte;

  if (signed) {
    // Sign-extend the last byte.
    let lastByte = result[byteLength - 1];
    const endBit = outIndex % 8;
    if (endBit !== 0) {
      const shift = 32 - endBit; // 32 because JS bit ops work on 32-bit ints.
      lastByte = result[byteLength - 1] = ((lastByte << shift) >> shift) & 0xff;
    }
    signBit = lastByte >> 7;
    signByte = signBit * 0xff;
  } else {
    signBit = 0;
    signByte = 0;
  }

  // Slice off any superfluous bytes, that is, ones that add no meaningful
  // bits (because the value would be the same if they were removed).
  while (
    byteLength > 1 &&
    result[byteLength - 1] === signByte &&
    (!signed || result[byteLength - 2] >> 7 === signBit)
  ) {
    byteLength--;
  }
  result = bufs.resize(result, byteLength);

  return { value: result, nextIndex: index };
}
599923
function(rawBuffer) {
    if (rawBuffer && this.offset === 0) return this.buffer;

    var out = new Buffer(8);
    this.buffer.copy(out, 0, this.offset, this.offset + 8);
    return out;
  }
303257
def commit(self):
        
        while len(self.__buffer) > 0:
            self.__run(self.__buffer.pop(0))
1317717
public static void copyBuffer(WsByteBuffer src, WsByteBuffer dst) {
        copyBuffer(src, dst, src.remaining());
    }
306238
public static void planarToBuffered_F32(Planar<GrayF32> src, DataBuffer buffer, BufferedImage dst) {
		if(BoofConcurrency.USE_CONCURRENT ) {
			try {
				if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst)) {
					ImplConvertRaster_MT.planarToBuffered_F32(src, (DataBufferByte) buffer, dst.getRaster());
				} else if (buffer.getDataType() == DataBuffer.TYPE_INT) {
					ImplConvertRaster_MT.planarToBuffered_F32(src, (DataBufferInt) buffer, dst.getRaster());
				} else {
					ImplConvertRaster_MT.planarToBuffered_F32(src, dst);
				}
				// hack so that it knows the buffer has been modified
				dst.setRGB(0, 0, dst.getRGB(0, 0));
			} catch (java.security.AccessControlException e) {
				ImplConvertRaster_MT.planarToBuffered_F32(src, dst);
			}
		} else {
			try {
				if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst)) {
					ImplConvertRaster.planarToBuffered_F32(src, (DataBufferByte) buffer, dst.getRaster());
				} else if (buffer.getDataType() == DataBuffer.TYPE_INT) {
					ImplConvertRaster.planarToBuffered_F32(src, (DataBufferInt) buffer, dst.getRaster());
				} else {
					ImplConvertRaster.planarToBuffered_F32(src, dst);
				}
				// hack so that it knows the buffer has been modified
				dst.setRGB(0, 0, dst.getRGB(0, 0));
			} catch (java.security.AccessControlException e) {
				ImplConvertRaster.planarToBuffered_F32(src, dst);
			}
		}
	}
278267
def buffer_put_lines(buf, lines):
    
    if any(isinstance(x, str) for x in lines):
        lines = [str(x) for x in lines]
    buf.write('\n'.join(lines))
88839
function updateGreyColorBuffer(buf) {
  for (let i = 0; i < buf.length; ++i) {
    buf[i] = 0.5;
  }
  return buf;
}
253448
public void flushSegmentIndexBuffers() {
        SegmentIndexBuffer sib = null;
        
        while((sib = _sibManager.poll()) != null) {
            File sibFile = getSegmentIndexBufferFile(sib.getSegmentId());
            try {
                _sibManager.getSegmentIndexBufferIO().write(sib, sibFile);
            } catch (Exception e) {
                _log.warn("failed to write " + sibFile.getAbsolutePath());
                sibFile.delete();
            }
        }
    }
470957
def swap_buffers(self):
        
        self.widget.swapBuffers()
        self.set_default_viewport()
        self.app.processEvents()
        self.frames += 1
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)
}
843867
public void flush() throws IOException {
        checkForClosed();
        writeBufferToFile();
        if (_currentOffset > _offset) { // something to commit
            _nfsFile.commit(_offset, (int) (_currentOffset - _offset));
            _offset = _currentOffset;
        }
        super.flush();
    }
164165
@FFDCIgnore({ IOException.class })
    private void flushUpgradedOutputBuffers() throws IOException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "flushUpgraded: Flushing buffers for Upgraded output: " + this);
        }
        final boolean writingBody = (hasBufferedContent());
        // flip the last buffer for the write...
        if (writingBody && null != this._output[this.outputIndex]) {
            this._output[this.outputIndex].flip();
        }
        try {
            WsByteBuffer[] content = (writingBody) ? this._output : null;
            // write it out to TCP            
            if(content != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushUpgraded:: Now write the content ");
                }
                _tcpContext.getWriteInterface().setBuffers(content);
                _tcpContext.getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, WCCustomProperties31.UPGRADE_WRITE_TIMEOUT);
            }
            else{
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushUpgraded: No more data to flush ");
                } 
            }

        } catch (IOException ioe) {
            this.error = ioe;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "flushUpgraded: Received exception during write: " + ioe);
            }
            throw ioe;
        } finally {
            this.bytesWritten += this.bufferedCount;            
            this.bufferedCount = 0;
            this.outputIndex = 0;
            // Note: this logic only works for sync writes
            if (writingBody) {
                if (null != this._output){
                    if (null != this._output[0]) {
                        this._output[0].clear();
                    }
                    for (int i = 1; i < this._output.length; i++) {
                        if (null != this._output[i]) {
                            // mark them empty so later writes don't mistake them
                            // as having content
                            this._output[i].position(0);
                            this._output[i].limit(0);
                        }
                    }
                }
            }
            // disconnect write buffers in TCP when done
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "flushUpgraded: disconnect write buffers in TCP when done");
            }
            _tcpContext.getWriteInterface().setBuffers(null);
        }
    }
232096
def dump_uvarint_b_into(n, buffer, offset=0):
    
    shifted = True
    while shifted:
        shifted = n >> 7
        buffer[offset] = (n & 0x7F) | (0x80 if shifted else 0x00)
        offset += 1
        n = shifted
    return buffer