@@ -1560,7 +1560,7 @@ final class JsonWriter private[jsoniter_scala](
1560
1560
pos += digitCount(exp)
1561
1561
count = pos
1562
1562
} else {
1563
- q = Math .multiplyHigh(exp, 6189700196426901375L ) >>> 25 // divide a positive long by 100000000
1563
+ q = NativeMath .multiplyHigh(exp, 6189700196426901375L ) >>> 25 // divide a positive long by 100000000
1564
1564
pos += digitCount(q)
1565
1565
count = write8Digits(exp - q * 100000000L , pos, buf, ds)
1566
1566
}
@@ -1696,7 +1696,7 @@ final class JsonWriter private[jsoniter_scala](
1696
1696
var hours = 0L
1697
1697
var secsOfHour = totalSecs.toInt
1698
1698
if (totalSecs >= 3600 ) {
1699
- hours = Math .multiplyHigh(totalSecs >> 4 , 655884233731895169L ) >> 3 // divide a positive long by 3600
1699
+ hours = NativeMath .multiplyHigh(totalSecs >> 4 , 655884233731895169L ) >> 3 // divide a positive long by 3600
1700
1700
secsOfHour = (totalSecs - hours * 3600 ).toInt
1701
1701
}
1702
1702
val minutes = secsOfHour * 17477 >> 20 // divide a small positive int by 60
@@ -1713,7 +1713,7 @@ final class JsonWriter private[jsoniter_scala](
1713
1713
lastPos += digitCount(hours)
1714
1714
pos = lastPos
1715
1715
} else {
1716
- q = Math .multiplyHigh(hours, 6189700196426901375L ) >>> 25 // divide a positive long by 100000000
1716
+ q = NativeMath .multiplyHigh(hours, 6189700196426901375L ) >>> 25 // divide a positive long by 100000000
1717
1717
lastPos += digitCount(q)
1718
1718
pos = write8Digits(hours - q * 100000000L , lastPos, buf, ds)
1719
1719
}
@@ -1766,9 +1766,9 @@ final class JsonWriter private[jsoniter_scala](
1766
1766
val epochSecond = x.getEpochSecond
1767
1767
if (epochSecond < 0 ) writeBeforeEpochInstant(epochSecond, x.getNano)
1768
1768
else {
1769
- val epochDay = Math .multiplyHigh(epochSecond, 1749024623285053783L ) >> 13 // epochSecond / 86400
1769
+ val epochDay = NativeMath .multiplyHigh(epochSecond, 1749024623285053783L ) >> 13 // epochSecond / 86400
1770
1770
val marchZeroDay = epochDay + 719468 // 719468 == 719528 - 60 == days 0000 to 1970 - days 1st Jan to 1st Mar
1771
- var year = (Math .multiplyHigh(marchZeroDay * 400 + 591 , 4137408090565272301L ) >> 15 ).toInt // ((marchZeroDay * 400 + 591) / 146097).toInt
1771
+ var year = (NativeMath .multiplyHigh(marchZeroDay * 400 + 591 , 4137408090565272301L ) >> 15 ).toInt // ((marchZeroDay * 400 + 591) / 146097).toInt
1772
1772
var days = year * 365L
1773
1773
var year1374389535 = year * 1374389535L
1774
1774
var century = (year1374389535 >> 37 ).toInt
@@ -1790,11 +1790,11 @@ final class JsonWriter private[jsoniter_scala](
1790
1790
}
1791
1791
1792
1792
private [this ] def writeBeforeEpochInstant (epochSecond : Long , nano : Int ): Unit = {
1793
- val epochDay = (Math .multiplyHigh(epochSecond - 86399 , 1749024623285053783L ) >> 13 ) + 1 // (epochSecond - 86399) / 86400
1793
+ val epochDay = (NativeMath .multiplyHigh(epochSecond - 86399 , 1749024623285053783L ) >> 13 ) + 1 // (epochSecond - 86399) / 86400
1794
1794
var marchZeroDay = epochDay + 719468 // 719468 == 719528 - 60 == days 0000 to 1970 - days 1st Jan to 1st Mar
1795
1795
val adjust400YearCycles = ((marchZeroDay + 1 ) * 7525902 >> 40 ).toInt // ((marchZeroDay + 1) / 146097).toInt - 1
1796
1796
marchZeroDay -= adjust400YearCycles * 146097L
1797
- var year = (Math .multiplyHigh(marchZeroDay * 400 + 591 , 4137408090565272301L ) >> 15 ).toInt // ((marchZeroDay * 400 + 591) / 146097).toInt
1797
+ var year = (NativeMath .multiplyHigh(marchZeroDay * 400 + 591 , 4137408090565272301L ) >> 15 ).toInt // ((marchZeroDay * 400 + 591) / 146097).toInt
1798
1798
var days = year * 365L
1799
1799
var year1374389535 = year * 1374389535L
1800
1800
var century = (year1374389535 >> 37 ).toInt
@@ -2140,8 +2140,8 @@ final class JsonWriter private[jsoniter_scala](
2140
2140
2141
2141
private [this ] def write18Digits (x : Long , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
2142
2142
val m1 = 6189700196426901375L
2143
- val q1 = Math .multiplyHigh(x, m1) >>> 25 // divide a positive long by 100000000
2144
- val q2 = Math .multiplyHigh(q1, m1) >>> 25 // divide a positive long by 100000000
2143
+ val q1 = NativeMath .multiplyHigh(x, m1) >>> 25 // divide a positive long by 100000000
2144
+ val q2 = NativeMath .multiplyHigh(q1, m1) >>> 25 // divide a positive long by 100000000
2145
2145
ByteArrayAccess .setShort(buf, pos, ds(q2.toInt))
2146
2146
write8Digits(x - q1 * 100000000L , write8Digits(q1 - q2 * 100000000L , pos + 2 , buf, ds), buf, ds)
2147
2147
}
@@ -2230,13 +2230,13 @@ final class JsonWriter private[jsoniter_scala](
2230
2230
pos = lastPos
2231
2231
} else {
2232
2232
val m2 = 6189700196426901375L
2233
- val q1 = Math .multiplyHigh(q0, m2) >>> 25 // divide a positive long by 100000000
2233
+ val q1 = NativeMath .multiplyHigh(q0, m2) >>> 25 // divide a positive long by 100000000
2234
2234
if (q1 < m1) {
2235
2235
q2 = q1
2236
2236
lastPos += digitCount(q1)
2237
2237
pos = lastPos
2238
2238
} else {
2239
- q2 = Math .multiplyHigh(q1, m2) >>> 25 // divide a small positive long by 100000000
2239
+ q2 = NativeMath .multiplyHigh(q1, m2) >>> 25 // divide a small positive long by 100000000
2240
2240
lastPos += digitCount(q2)
2241
2241
pos = write8Digits(q1 - q2 * m1, lastPos, buf, ds)
2242
2242
}
@@ -2354,7 +2354,7 @@ final class JsonWriter private[jsoniter_scala](
2354
2354
}
2355
2355
2356
2356
private [this ] def rop (g : Long , cp : Int ): Int = {
2357
- val x = Math .multiplyHigh(g, cp.toLong << 32 )
2357
+ val x = NativeMath .multiplyHigh(g, cp.toLong << 32 )
2358
2358
(x >>> 31 ).toInt | - x.toInt >>> 31
2359
2359
}
2360
2360
@@ -2407,7 +2407,7 @@ final class JsonWriter private[jsoniter_scala](
2407
2407
val vbr = rop(g1, g0, cb + 2 << h) - vbCorr
2408
2408
var diff = 0
2409
2409
if (vb < 400 || {
2410
- m10 = Math .multiplyHigh(vb, 461168601842738792L ) // divide a positive long by 40
2410
+ m10 = NativeMath .multiplyHigh(vb, 461168601842738792L ) // divide a positive long by 40
2411
2411
val vb40 = m10 * 40
2412
2412
diff = (vbl - vb40).toInt
2413
2413
((vb40 - vbr).toInt + 40 ^ diff) >= 0
@@ -2470,8 +2470,8 @@ final class JsonWriter private[jsoniter_scala](
2470
2470
}
2471
2471
2472
2472
private [this ] def rop (g1 : Long , g0 : Long , cp : Long ): Long = {
2473
- val x = Math .multiplyHigh(g0, cp) + (g1 * cp >>> 1 )
2474
- Math .multiplyHigh(g1, cp) + (x >>> 63 ) | (- x ^ x) >>> 63
2473
+ val x = NativeMath .multiplyHigh(g0, cp) + (g1 * cp >>> 1 )
2474
+ NativeMath .multiplyHigh(g1, cp) + (x >>> 63 ) | (- x ^ x) >>> 63
2475
2475
}
2476
2476
2477
2477
// Adoption of a nice trick from Daniel Lemire's blog that works for numbers up to 10^18:
@@ -2483,7 +2483,7 @@ final class JsonWriter private[jsoniter_scala](
2483
2483
var pos = p
2484
2484
var posLim = pl
2485
2485
if (q0 != x) {
2486
- val q1 = (Math .multiplyHigh(x, 6189700196426901375L ) >>> 25 ).toInt // divide a positive long by 100000000
2486
+ val q1 = (NativeMath .multiplyHigh(x, 6189700196426901375L ) >>> 25 ).toInt // divide a positive long by 100000000
2487
2487
val r1 = (x - q1 * 100000000L ).toInt
2488
2488
val posm8 = pos - 8
2489
2489
if (r1 == 0 ) {
0 commit comments