diff --git a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java index 92765b9b4a..6896f71195 100644 --- a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java +++ b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java @@ -1414,14 +1414,14 @@ public abstract class CodedOutputStream extends ByteOutput { public final void writeFixed64NoTag(long value) throws IOException { int position = this.position; // Perf: hoist field to register to avoid load/stores. try { - buffer[position] = (byte) ((int) value); - buffer[position + 1] = (byte) ((int) (value >> 8)); - buffer[position + 2] = (byte) ((int) (value >> 16)); - buffer[position + 3] = (byte) ((int) (value >> 24)); - buffer[position + 4] = (byte) ((int) (value >> 32)); - buffer[position + 5] = (byte) ((int) (value >> 40)); - buffer[position + 6] = (byte) ((int) (value >> 48)); - buffer[position + 7] = (byte) ((int) (value >> 56)); + buffer[position] = (byte) value; + buffer[position + 1] = (byte) (value >> 8); + buffer[position + 2] = (byte) (value >> 16); + buffer[position + 3] = (byte) (value >> 24); + buffer[position + 4] = (byte) (value >> 32); + buffer[position + 5] = (byte) (value >> 40); + buffer[position + 6] = (byte) (value >> 48); + buffer[position + 7] = (byte) (value >> 56); } catch (IndexOutOfBoundsException e) { throw new OutOfSpaceException(position, limit, FIXED64_SIZE, e); } @@ -2384,10 +2384,10 @@ public abstract class CodedOutputStream extends ByteOutput { buffer[position++] = (byte) (value >> 8); buffer[position++] = (byte) (value >> 16); buffer[position++] = (byte) (value >> 24); - buffer[position++] = (byte) ((int) (value >> 32)); - buffer[position++] = (byte) ((int) (value >> 40)); - buffer[position++] = (byte) ((int) (value >> 48)); - buffer[position++] = (byte) ((int) (value >> 56)); + buffer[position++] = (byte) (value >> 32); + buffer[position++] = (byte) (value >> 40); + buffer[position++] = (byte) (value >> 48); + buffer[position++] = (byte) (value >> 56); this.position = position; totalBytesWritten += FIXED64_SIZE; }