Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.beam.sdk.util;

import com.google.protobuf.CodedOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -136,16 +137,11 @@ public static long decodeLong(InputStream stream) throws IOException {

/** Returns the length of the encoding of the given value (in bytes). */
public static int getLength(int v) {
return getLength(convertIntToLongNoSignExtend(v));
return CodedOutputStream.computeUInt32SizeNoTag(v);
}

/** Returns the length of the encoding of the given value (in bytes). */
public static int getLength(long v) {
int result = 0;
do {
result++;
v >>>= 7;
} while (v != 0);
return result;
return CodedOutputStream.computeUInt64SizeNoTag(v);
}
}
Loading