readVarInt = decoder => {
  let r = decoder.arr[decoder.pos++];
  let num = r & binary.BITS6;
  let len = 6;
  const sign = (r & binary.BIT7) > 0 ? -1 : 1;

  if ((r & binary.BIT8) === 0) {
    // don't continue reading
    return sign * num;
  }

  while (true) {
    r = decoder.arr[decoder.pos++];
    num = num | (r & binary.BITS7) << len;
    len += 7;

    if (r < binary.BIT8) {
      return sign * (num >>> 0);
    }
    /* istanbul ignore if */


    if (len > 41) {
      throw new Error('Integer out of range!');
    }
  }
}
Read signed integer (32bit) with variable length.
1/8th of the storage is used as encoding overhead.
 * numbers < 2^7 is stored in one bytlength
 * numbers < 2^14 is stored in two bylength
@todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.

@function
@param {Decoder} decoder
@return {number} An unsigned integer.length