Skip to content

Commit

Permalink
More efficient serialization of Double and big java.time.Duration
Browse files Browse the repository at this point in the history
… values using Scala.js
  • Loading branch information
plokhotnyuk committed Jul 10, 2024
1 parent 39bf5d5 commit c5dddd9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1787,10 +1787,9 @@ final class JsonWriter private[jsoniter_scala](
lastPos += digitCount(q)
pos = lastPos
} else {
val q1 = hours / 100000000
q = q1.toInt
q = ((hours >>> 8) * 2.56e-6).toInt
lastPos += digitCount(q)
pos = write8Digits((hours - q1 * 100000000).toInt, lastPos, buf, ds)
pos = write8Digits((hours - q * 100000000L).toInt, lastPos, buf, ds)
}
writePositiveIntDigits(q, lastPos, buf, ds)
buf(pos) = 'H'
Expand Down Expand Up @@ -2588,7 +2587,7 @@ final class JsonWriter private[jsoniter_scala](
var pos = p
var posLim = pl
if (q0 != x) {
val q1 = (x / 100000000).toInt // divide a positive long by 100000000
val q1 = ((x >>> 8) * 2.56e-6).toInt // divide a positive long by 100000000
val r1 = (x - q1 * 100000000L).toInt
val posm8 = pos - 8
if (r1 == 0) {
Expand Down

0 comments on commit c5dddd9

Please sign in to comment.