appendUint32(value) {
    if (!Number.isInteger(value))
      throw new RangeError("value is not an integer")
    if (value < 0 || value > 0xffffffff)
      throw new RangeError("number out of range")

    const numBytes = Math.max(1, Math.ceil((32 - Math.clz32(value)) / 7))
    if (this.offset + numBytes > this.buf.byteLength) this.grow()

    for (let i = 0; i < numBytes; i++) {
      this.buf[this.offset + i] =
        (value & 0x7f) | (i === numBytes - 1 ? 0x00 : 0x80)
      value >>>= 7 // zero-filling right shift
    }
    this.offset += numBytes
    return numBytes
  }
Encodes a 32-bit nonnegative integer in a variable number of bytes using
the LEB128 encoding scheme (https://en.wikipedia.org/wiki/LEB128) and
appends it to the buffer. Returns the number of bytes written.