Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Sep 2, 2024
1 parent e2523cf commit 249bd61
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ final class JsonWriter private[jsoniter_scala](
val pos = ensureBufCapacity(38) // 38 == (new java.util.UUID(0, 0)).toString.length + 2
val buf = this.buf
val ds = lowerCaseHexDigits
val mostSigBits1 = (mostSigBits >> 32).toInt
val mostSigBits1 = (mostSigBits >>> 32).toInt
buf(pos) = '"'
val d1 = ds(mostSigBits1 >>> 24)
buf(pos + 1) = d1.toByte
Expand Down Expand Up @@ -1403,7 +1403,7 @@ final class JsonWriter private[jsoniter_scala](
val d8 = ds(mostSigBits2 & 0xFF)
buf(pos + 17) = d8.toByte
buf(pos + 18) = (d8 >> 8).toByte
val leastSigBits1 = (leastSigBits >> 32).toInt
val leastSigBits1 = (leastSigBits >>> 32).toInt
buf(pos + 19) = '-'
val d9 = ds(leastSigBits1 >>> 24)
buf(pos + 20) = d9.toByte
Expand Down Expand Up @@ -2024,12 +2024,13 @@ final class JsonWriter private[jsoniter_scala](
if ((years | months | days) == 0) {
buf(pos) = '0'
buf(pos + 1) = 'D'
pos += 2
buf(pos + 2) = '"'
count = pos + 3
} else {
val ds = digits
var b: Byte = 'Y'
var q0 = years
while ({
var b: Byte = 'Y'
while (true) {
if (q0 != 0) {
if (q0 < 0) {
q0 = -q0
Expand All @@ -2047,18 +2048,18 @@ final class JsonWriter private[jsoniter_scala](
pos += 1
}
if (b == 'Y') {
b = 'M'
q0 = months
true
b = 'M'
} else if (b == 'M') {
b = 'D'
q0 = days
true
} else false
}) ()
b = 'D'
} else {
buf(pos) = '"'
count = pos + 1
return
}
}
}
buf(pos) = '"'
count = pos + 1
}

private[this] def writeYear(x: Year): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ final class JsonWriter private[jsoniter_scala](
ByteArrayAccess.setShort(buf, pos, ds(q0))
pos += 2
} else {
ByteArrayAccess.setInt(buf, pos, ds(q0 - 100) << 8 | 0x31)
ByteArrayAccess.setInt(buf, pos, ds(q0 - 100) << 8 | '1')
pos += 3
}
count = pos
Expand Down Expand Up @@ -1805,13 +1805,13 @@ final class JsonWriter private[jsoniter_scala](
val months = x.getMonths
val days = x.getDays
ByteArrayAccess.setLong(buf, pos, 0x2244305022L)
if ((years | months | days) == 0) pos += 5
if ((years | months | days) == 0) count = pos + 5
else {
pos += 2
val ds = digits
var q0 = years
var b: Byte = 'Y'
while ({
while (true) {
if (q0 != 0) {
if (q0 < 0) {
q0 = -q0
Expand All @@ -1828,19 +1828,18 @@ final class JsonWriter private[jsoniter_scala](
pos += 1
}
if (b == 'Y') {
b = 'M'
q0 = months
true
b = 'M'
} else if (b == 'M') {
b = 'D'
q0 = days
true
} else false
}) ()
buf(pos) = '"'
pos += 1
b = 'D'
} else {
buf(pos) = '"'
count = pos + 1
return
}
}
}
count = pos
}

private[this] def writeYear(x: Year): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ final class JsonWriter private[jsoniter_scala](
ByteArrayAccess.setShort(buf, pos, ds(q0))
pos += 2
} else {
ByteArrayAccess.setInt(buf, pos, ds(q0 - 100) << 8 | 0x31)
ByteArrayAccess.setInt(buf, pos, ds(q0 - 100) << 8 | '1')
pos += 3
}
count = pos
Expand Down Expand Up @@ -1805,13 +1805,13 @@ final class JsonWriter private[jsoniter_scala](
val months = x.getMonths
val days = x.getDays
ByteArrayAccess.setLong(buf, pos, 0x2244305022L)
if ((years | months | days) == 0) pos += 5
if ((years | months | days) == 0) count = pos + 5
else {
pos += 2
val ds = digits
var q0 = years
var b: Byte = 'Y'
while ({
while (true) {
if (q0 != 0) {
if (q0 < 0) {
q0 = -q0
Expand All @@ -1828,19 +1828,18 @@ final class JsonWriter private[jsoniter_scala](
pos += 1
}
if (b == 'Y') {
b = 'M'
q0 = months
true
b = 'M'
} else if (b == 'M') {
b = 'D'
q0 = days
true
} else false
}) ()
buf(pos) = '"'
pos += 1
b = 'D'
} else {
buf(pos) = '"'
count = pos + 1
return
}
}
}
count = pos
}

private[this] def writeYear(x: Year): Unit = {
Expand Down

0 comments on commit 249bd61

Please sign in to comment.