@@ -1114,6 +1114,7 @@ final class JsonWriter private[jsoniter_scala](
11141114 }
11151115 }
11161116
1117+ @ inline
11171118 private [this ] def writeNestedStart (b : Byte ): Unit = {
11181119 writeOptionalCommaAndIndentionBeforeKey()
11191120 writeBytes(b)
@@ -1124,6 +1125,7 @@ final class JsonWriter private[jsoniter_scala](
11241125 }
11251126 }
11261127
1128+ @ inline
11271129 private [this ] def writeNestedEnd (b : Byte ): Unit = {
11281130 comma = true
11291131 if (indention != 0 ) {
@@ -1290,6 +1292,7 @@ final class JsonWriter private[jsoniter_scala](
12901292 count = pos + 1
12911293 }
12921294
1295+ @ inline
12931296 private [this ] def writeRawBytes (bs : Array [Byte ]): Unit = {
12941297 var pos = count
12951298 var step = Math .max(config.preferredBufSize, limit - pos)
@@ -1551,6 +1554,7 @@ final class JsonWriter private[jsoniter_scala](
15511554 count = pos + 1
15521555 }
15531556
1557+ @ inline
15541558 private [this ] def writeEscapedUnicode (ch : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
15551559 buf(pos) = '\\ '
15561560 buf(pos + 1 ) = 'u'
@@ -1563,6 +1567,7 @@ final class JsonWriter private[jsoniter_scala](
15631567 pos + 6
15641568 }
15651569
1570+ @ inline
15661571 private [this ] def writeEscapedUnicode (b : Byte , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
15671572 buf(pos) = '\\ '
15681573 buf(pos + 1 ) = 'u'
@@ -1674,6 +1679,7 @@ final class JsonWriter private[jsoniter_scala](
16741679 writeBigDecimalRemainder(qr(1 ), scale, blockScale, n - 1 , ss)
16751680 }
16761681
1682+ @ inline
16771683 private [this ] def calculateTenPow18SquareNumber (bitLen : Int ): Int = {
16781684 val m = Math .max((bitLen * 0.016723888647998956 ).toInt - 1 , 1 ) // Math.max((x.bitLength * Math.log(2) / Math.log(1e18)).toInt - 1, 1)
16791685 31 - java.lang.Integer .numberOfLeadingZeros(m)
@@ -1886,6 +1892,7 @@ final class JsonWriter private[jsoniter_scala](
18861892 writeInstant(year, month, day, secsOfDay, x.getNano)
18871893 }
18881894
1895+ @ inline
18891896 private [this ] def writeInstant (year : Int , month : Int , day : Int , secsOfDay : Int , nano : Int ): Unit = {
18901897 var pos = ensureBufCapacity(39 ) // 39 == Instant.MAX.toString.length + 2
18911898 val buf = this .buf
@@ -2095,6 +2102,7 @@ final class JsonWriter private[jsoniter_scala](
20952102 write2Digits(month, pos + 1 , buf, ds)
20962103 }
20972104
2105+ @ inline
20982106 private [this ] def writeYear (year : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int =
20992107 if (year >= 0 && year < 10000 ) write4Digits(year, pos, buf, ds)
21002108 else writeYearWithSign(year, pos, buf, ds)
@@ -2185,13 +2193,15 @@ final class JsonWriter private[jsoniter_scala](
21852193 }
21862194 }
21872195
2196+ @ inline
21882197 private [this ] def write2Digits (x : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
21892198 val d = ds(x)
21902199 buf(pos) = d.toByte
21912200 buf(pos + 1 ) = (d >> 8 ).toByte
21922201 pos + 2
21932202 }
21942203
2204+ @ inline
21952205 private [this ] def write3Digits (x : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
21962206 val q1 = x * 1311 >> 17 // divide a small positive int by 100
21972207 buf(pos) = (q1 + '0' ).toByte
@@ -2201,6 +2211,7 @@ final class JsonWriter private[jsoniter_scala](
22012211 pos + 3
22022212 }
22032213
2214+ @ inline
22042215 private [this ] def write4Digits (x : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
22052216 val q1 = x * 5243 >> 19 // divide a small positive int by 100
22062217 val d1 = ds(q1)
@@ -2212,6 +2223,7 @@ final class JsonWriter private[jsoniter_scala](
22122223 pos + 4
22132224 }
22142225
2226+ @ inline
22152227 private [this ] def write8Digits (x : Int , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
22162228 val q1 = x / 10000
22172229 val q2 = q1 * 5243 >> 19 // divide a small positive int by 100
@@ -2232,6 +2244,7 @@ final class JsonWriter private[jsoniter_scala](
22322244 pos + 8
22332245 }
22342246
2247+ @ inline
22352248 private [this ] def write18Digits (x : Long , pos : Int , buf : Array [Byte ], ds : Array [Short ]): Int = {
22362249 val q1 = ((x >>> 8 ) * 2.56e-6 ).toLong // divide a medium positive long by 100000000
22372250 write8Digits((x - q1 * 100000000L ).toInt, {
@@ -2286,6 +2299,7 @@ final class JsonWriter private[jsoniter_scala](
22862299 count = pos
22872300 }
22882301
2302+ @ inline
22892303 private [this ] def writeLong (x : Long ): Unit =
22902304 count = writeLong(x, ensureBufCapacity(20 ), buf) // Long.MinValue.toString.length
22912305
@@ -2456,6 +2470,7 @@ final class JsonWriter private[jsoniter_scala](
24562470 count = pos
24572471 }
24582472
2473+ @ inline
24592474 private [this ] def rop (g : Long , cp : Int ): Int = {
24602475 val x = ((g & 0xFFFFFFFFL) * cp >>> 32 ) + (g >>> 32 ) * cp
24612476 (x >>> 31 ).toInt | - x.toInt >>> 31
@@ -2587,6 +2602,7 @@ final class JsonWriter private[jsoniter_scala](
25872602 count = pos
25882603 }
25892604
2605+ @ inline
25902606 private [this ] def rop (g1 : Long , g0 : Long , cp : Long ): Long = {
25912607 val x = multiplyHigh(g0, cp) + (g1 * cp >>> 1 )
25922608 var y = multiplyHigh(g1, cp)
@@ -2595,6 +2611,7 @@ final class JsonWriter private[jsoniter_scala](
25952611 y
25962612 }
25972613
2614+ @ inline
25982615 private [this ] def multiplyHigh (x : Long , y : Long ): Long = { // Karatsuba technique for two positive longs
25992616 val x2 = x & 0xFFFFFFFFL
26002617 val y2 = y & 0xFFFFFFFFL
@@ -2605,6 +2622,7 @@ final class JsonWriter private[jsoniter_scala](
26052622 ((b >>> 32 ) + (x1 + x2) * (y1 + y2) - b - a >>> 32 ) + a
26062623 }
26072624
2625+ @ inline
26082626 private [this ] def digitCount (q0 : Long ): Int =
26092627 if (q0 >= 1000000000000000L ) {
26102628 if (q0 >= 10000000000000000L ) 17
@@ -2708,6 +2726,7 @@ final class JsonWriter private[jsoniter_scala](
27082726
27092727 private [this ] def illegalNumberError (x : Double ): Nothing = encodeError(" illegal number: " + x)
27102728
2729+ @ inline
27112730 private [this ] def ensureBufCapacity (required : Int ): Int = {
27122731 val pos = count
27132732 if (pos + required <= limit) pos
0 commit comments