aboutsummaryrefslogtreecommitdiffhomepage
path: root/java/core/src/main/java/com/google/protobuf/Utf8.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/core/src/main/java/com/google/protobuf/Utf8.java')
-rw-r--r--java/core/src/main/java/com/google/protobuf/Utf8.java2
1 files changed, 1 insertions, 1 deletions
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;