From d36c0c538a545fac5d9db6ba65c525246d4efa95 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Wed, 29 Mar 2017 14:32:48 -0700 Subject: Down-integrate from google3. --- java/core/src/main/java/com/google/protobuf/Utf8.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'java/core/src/main/java/com/google/protobuf/Utf8.java') diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java index 5b80d405..be7b746e 100644 --- a/java/core/src/main/java/com/google/protobuf/Utf8.java +++ b/java/core/src/main/java/com/google/protobuf/Utf8.java @@ -1332,7 +1332,7 @@ final class Utf8 { // the index (relative to the start of the array) is also 8-byte aligned. We do this by // ANDing the index with 7 to determine the number of bytes that need to be read before // we're 8-byte aligned. - final int unaligned = (int) offset & 7; + final int unaligned = 8 - ((int) offset & 7); for (int j = unaligned; j > 0; j--) { if (UnsafeUtil.getByte(bytes, offset++) < 0) { return unaligned - j; -- cgit v1.2.3