@@ -2478,7 +2478,7 @@ final class JsonWriter private[jsoniter_scala](
24782478 diff = (vbl - vb4).toInt + vbCorr
24792479 if (((vb4 - vbr).toInt + vbCorr + 4 ^ diff) >= 0 ) diff = (vb.toInt & 0x3 ) + (m10.toInt & 0x1 ) - 3
24802480 } else e10Corr = - 1
2481- m10 += ~ diff >>> 31
2481+ if ( diff >= 0 ) m10 += 1
24822482 e10 -= e10Corr
24832483 }
24842484 val len = digitCount(m10)
@@ -2534,13 +2534,10 @@ final class JsonWriter private[jsoniter_scala](
25342534
25352535 private [this ] def rop (g1 : Long , g0 : Long , cp : Long ): Long = {
25362536 val x = multiplyHigh(g0, cp) + (g1 * cp >>> 1 )
2537- multiplyHigh(g1, cp) + {
2538- if (x < 0 ) 1
2539- else 0
2540- } | {
2541- if (- x != x) 1
2542- else 0
2543- }
2537+ var y = multiplyHigh(g1, cp)
2538+ if (x < 0 ) y += 1
2539+ if (- x != x) y |= 1
2540+ y
25442541 }
25452542
25462543 private [this ] def multiplyHigh (x : Long , y : Long ): Long = { // Karatsuba technique for two positive longs
@@ -2553,23 +2550,20 @@ final class JsonWriter private[jsoniter_scala](
25532550 ((b >>> 32 ) + (x1 + x2) * (y1 + y2) - b - a >>> 32 ) + a
25542551 }
25552552
2556- private [this ] def digitCount (q0 : Long ): Int = {
2557- val q = q0.toInt
2558- if (q == q0) digitCount(q)
2559- else if (q0 < 10000000000L ) {
2560- if (q0 < 1000000000L ) 9
2561- else 10
2562- } else if (q0 < 1000000000000L ) {
2563- if (q0 < 100000000000L ) 11
2564- else 12
2565- } else if (q0 < 100000000000000L ) {
2566- if (q0 < 10000000000000L ) 13
2567- else 14
2568- } else if (q0 < 10000000000000000L ) {
2569- if (q0 < 1000000000000000L ) 15
2553+ private [this ] def digitCount (q0 : Long ): Int =
2554+ if (q0 >= 1000000000000000L ) {
2555+ if (q0 >= 10000000000000000L ) 17
25702556 else 16
2571- } else 17
2572- }
2557+ } else if (q0 >= 10000000000000L ) {
2558+ if (q0 >= 100000000000000L ) 15
2559+ else 14
2560+ } else if (q0 >= 100000000000L ) {
2561+ if (q0 >= 1000000000000L ) 13
2562+ else 12
2563+ } else if (q0 >= 1000000000L ) {
2564+ if (q0 >= 10000000000L ) 11
2565+ else 10
2566+ } else digitCount(q0.toInt)
25732567
25742568 private [this ] def digitCount (x : Int ): Int =
25752569 if (x < 100 ) (9 - x >>> 31 ) + 1
0 commit comments