Skip to content

Commit

Permalink
More inlining for Scala.js
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Oct 24, 2024
1 parent 0cea612 commit 5778631
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or dection of leading zero or
* illegal format of JSON value or exceeding capacity of `Byte`
*/
@inline
def readByte(): Byte = readByte(isToken = true)

/**
Expand All @@ -569,6 +570,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
* illegal format of JSON value or exceeding capacity of `Short`
*/
@inline
def readShort(): Short = readShort(isToken = true)

/**
Expand All @@ -578,6 +580,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
* illegal format of JSON value or exceeding capacity of `Int`
*/
@inline
def readInt(): Int = readInt(isToken = true)

/**
Expand All @@ -587,6 +590,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
* illegal format of JSON value or exceeding capacity of `Long`
*/
@inline
def readLong(): Long = readLong(isToken = true)

/**
Expand All @@ -596,6 +600,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
* illegal format of JSON value
*/
@inline
def readDouble(): Double = readDouble(isToken = true)

/**
Expand All @@ -605,6 +610,7 @@ final class JsonReader private[jsoniter_scala](
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
* illegal format of JSON value
*/
@inline
def readFloat(): Float = readFloat(isToken = true)

/**
Expand Down Expand Up @@ -2313,6 +2319,7 @@ final class JsonReader private[jsoniter_scala](

// Based on the 'Moderate Path' algorithm from the awesome library of Alexander Huszagh: https://github.com/Alexhuszagh/rust-lexical
// Here is his inspiring post: https://www.reddit.com/r/rust/comments/a6j5j1/making_rust_float_parsing_fast_and_correct
@inline
private[this] def toDouble(m10: Long, e10: Int, from: Int, newMark: Int, pos: Int): Double =
if (m10 == 0L || e10 < -343) 0.0
else if (e10 >= 310) Double.PositiveInfinity
Expand Down Expand Up @@ -2457,6 +2464,7 @@ final class JsonReader private[jsoniter_scala](

// Based on the 'Moderate Path' algorithm from the awesome library of Alexander Huszagh: https://github.com/Alexhuszagh/rust-lexical
// Here is his inspiring post: https://www.reddit.com/r/rust/comments/a6j5j1/making_rust_float_parsing_fast_and_correct
@inline
private[this] def toFloat(m10: Long, e10: Int, from: Int, newMark: Int, pos: Int): Float =
if (m10 == 0L || e10 < -64) 0.0f
else if (e10 >= 39) Float.PositiveInfinity
Expand Down

0 comments on commit 5778631

Please sign in to comment.