src/buffer-writer.js
// with top bit set to signify that another byte follows)
with top bit set to signify that another byte follows)
with top bit set to signify that another byte follows )
function writeVarInt(value) {
    var buffer = value & 0x7F;
    var bytes = [];
    while ((value = value >> 7)) {
      buffer <<= 8;
      buffer |= ((value & 0x7F) | 0x80);
    }
    while (true) {
      bytes.push(buffer & 0xff);
      if (buffer & 0x80)
        buffer >>= 8;
      else
        break;
    }
    var length = bytes.length;
    _buffer = transfer(_buffer, (_buffer.byteLength + length));
    var view = new DataView(_buffer);
    for (var i = 0; i < length; i++) {
      view.setInt8(_position, bytes[i]);
      _position += 1;
    }
    return this;
  }
function writeVarInt ( value ) { var buffer = value & 0x7F ; var bytes = [ ] ; while ( ( value = value >> 7 ) ) { buffer <<= 8 ; buffer |= ( ( value & 0x7F ) | 0x80 ) ; } while ( true ) { bytes . push ( buffer & 0xff ) ; if ( buffer & 0x80 ) buffer >>= 8 ; else break ; } var length = bytes . length ; _buffer = transfer ( _buffer , ( _buffer . byteLength + length ) ) ; var view = new DataView ( _buffer ) ; for ( var i = 0 ; i < length ; i ++ ) { view . setInt8 ( _position , bytes [ i ] ) ; _position += 1 ; } return this ; }
with top bit set to signify that another byte follows)
with top bit set to signify that another byte follows )
// create varInt // write varInt