@@ -2478,7 +2478,7 @@ final class JsonWriter private[jsoniter_scala](
2478
2478
diff = (vbl - vb4).toInt + vbCorr
2479
2479
if (((vb4 - vbr).toInt + vbCorr + 4 ^ diff) >= 0 ) diff = (vb.toInt & 0x3 ) + (m10.toInt & 0x1 ) - 3
2480
2480
} else e10Corr = - 1
2481
- m10 += ~ diff >>> 31
2481
+ if ( diff >= 0 ) m10 += 1
2482
2482
e10 -= e10Corr
2483
2483
}
2484
2484
val len = digitCount(m10)
@@ -2534,13 +2534,10 @@ final class JsonWriter private[jsoniter_scala](
2534
2534
2535
2535
private [this ] def rop (g1 : Long , g0 : Long , cp : Long ): Long = {
2536
2536
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
2544
2541
}
2545
2542
2546
2543
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](
2553
2550
((b >>> 32 ) + (x1 + x2) * (y1 + y2) - b - a >>> 32 ) + a
2554
2551
}
2555
2552
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
2570
2556
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)
2573
2567
2574
2568
private [this ] def digitCount (x : Int ): Int =
2575
2569
if (x < 100 ) (9 - x >>> 31 ) + 1
0 commit comments