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

    const numBytes = Math.ceil(
      (33 - Math.clz32(value >= 0 ? value : -value - 1)) / 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 // sign-propagating right shift
    }
    this.offset += numBytes
    return numBytes
  }
Encodes a 32-bit signed 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.