kennknowles commented on code in PR #29689:
URL: https://github.com/apache/beam/pull/29689#discussion_r2029146440


##########
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:
   I happen to be browsing the history, and this sort of change really needs a 
comment so that someone landing on it knows the details of the decision, such 
as a summary or even a link to the numbers in this PR.



-- 
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

Reply via email to