kennknowles commented on code in PR #29689: URL: https://github.com/apache/beam/pull/29689#discussion_r2029146918
########## sdks/java/core/src/main/java/org/apache/beam/sdk/util/VarInt.java: ########## @@ -42,13 +42,61 @@ public static void encode(int v, OutputStream stream) throws IOException { /** Encodes the given value onto the stream. */ public static void encode(long v, OutputStream stream) throws IOException { - do { - // Encode next 7 bits + terminator bit - long bits = v & 0x7F; - v >>>= 7; - byte b = (byte) (bits | ((v != 0) ? 0x80 : 0)); - stream.write(b); - } while (v != 0); + if ((v & ~0x7F) == 0) { Review Comment: (or else they might think "meh I'll change this to simplify") -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org