public static int varintSizeInBytes(int value) {
    if ((value & (0xffffffff << 7)) == 0) return 1;
    if ((value & (0xffffffff << 14)) == 0) return 2;
    if ((value & (0xffffffff << 21)) == 0) return 3;
    if ((value & (0xffffffff << 28)) == 0) return 4;
    return 5;
  }
A base 128 varint encodes 7 bits at a time, this checks how many bytes are needed to represent
the value.

<p>See https://developers.google.com/protocol-buffers/docs/encoding#varints

<p>This logic is the same as {@code com.squareup.wire.ProtoWriter.varint32Size} v2.3.0 which
benchmarked faster than loop variants of the frequently copy/pasted VarInt.varIntSize
zipkin/src/main/java/zipkin2/internal/WriteBuffer.java