Skip to content

Commit b74d28c

Browse files
committed
Clean up code
1 parent cca1d0b commit b74d28c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonReader.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,8 +2521,8 @@ final class JsonReader private[jsoniter_scala](
25212521
} else parseEncodedString(i, charBuf.length - 1, charBuf, pos)
25222522
} else if (pos >= tail) {
25232523
val newPos = loadMoreOrError(pos)
2524-
parseString(i, i + Math.min(minLim - i, tail - newPos), charBuf, newPos)
2525-
} else parseString(i, i + Math.min(growCharBuf(i + 1) - i, tail - pos), this.charBuf, pos)
2524+
parseString(i, Math.min(minLim, i + tail - newPos), charBuf, newPos)
2525+
} else parseString(i, Math.min(growCharBuf(i + 1), i + tail - pos), this.charBuf, pos)
25262526

25272527
@tailrec
25282528
private def parseEncodedString(i: Int, lim: Int, charBuf: Array[Char], pos: Int): Int =
@@ -2647,13 +2647,13 @@ final class JsonReader private[jsoniter_scala](
26472647
val b2 = buf(pos + 1)
26482648
if ((b1 & 0x1E) == 0 || (b2 & 0xC0) != 0x80) malformedBytesError(b1, b2, pos)
26492649
head = pos + 2
2650-
((b1 << 6) ^ b2 ^ 0xF80).toChar // 0xF80 == ((0xC0.toByte << 6) ^ 0x80.toByte)
2650+
((b1 << 6) ^ (b2 ^ 0xF80)).toChar // 0xF80 == ((0xC0.toByte << 6) ^ 0x80.toByte)
26512651
} else parseChar(loadMoreOrError(pos))
26522652
} else if ((b1 >> 4) == -2) { // 3 bytes, 16 bits: 1110xxxx 10xxxxxx 10xxxxxx
26532653
if (remaining > 2) {
26542654
val b2 = buf(pos + 1)
26552655
val b3 = buf(pos + 2)
2656-
val ch = ((b1 << 12) ^ (b2 << 6) ^ b3 ^ 0xFFFE1F80).toChar // 0xFFFE1F80 == ((0xE0.toByte << 12) ^ (0x80.toByte << 6) ^ 0x80.toByte)
2656+
val ch = ((b1 << 12) ^ (b2 << 6) ^ (b3 ^ 0xFFFE1F80)).toChar // 0xFFFE1F80 == ((0xE0.toByte << 12) ^ (0x80.toByte << 6) ^ 0x80.toByte)
26572657
if ((b1 == 0xE0.toByte && (b2 & 0xE0) == 0x80) || (b2 & 0xC0) != 0x80 || (b3 & 0xC0) != 0x80 ||
26582658
(ch >= 0xD800 && ch <= 0xDFFF)) malformedBytesError(b1, b2, b3, pos)
26592659
head = pos + 3

0 commit comments

Comments
 (0)