Skip to content

Commit 49a419e

Browse files
committed
Fix Reader.longCompare returning the wrong sign on substraction overflow, closes #829
1 parent 9e24915 commit 49a419e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

core/src/main/scala/io/bullet/borer/Reader.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
package io.bullet.borer
1010

11-
import java.nio.charset.StandardCharsets
12-
import io.bullet.borer.internal.{ElementDeque, Parser, Receptacle, Util}
11+
import io.bullet.borer.internal.*
1312
import io.bullet.borer.json.JsonParser
1413

14+
import java.nio.charset.StandardCharsets
1515
import scala.annotation.tailrec
1616
import scala.collection.{mutable, Factory}
1717

@@ -25,7 +25,7 @@ final class InputReader[Config <: Reader.Config](
2525
config: Config,
2626
val target: Target):
2727

28-
import io.bullet.borer.{DataItem => DI}
28+
import io.bullet.borer.DataItem as DI
2929

3030
private[this] val configReadIntegersAlsoAsFloatingPoint = config.readIntegersAlsoAsFloatingPoint
3131
private[this] val configReadDoubleAlsoAsFloat = config.readDoubleAlsoAsFloat
@@ -161,7 +161,7 @@ final class InputReader[Config <: Reader.Config](
161161
def longCompare(value: Long): Int =
162162
if (hasLong)
163163
val long = if (hasInt) receptacle.intValue.toLong else receptacle.longValue
164-
math.signum(long - value).toInt
164+
java.lang.Long.compare(long, value)
165165
else Int.MaxValue
166166

167167
def tryReadLongCompare(value: Long): Int =

0 commit comments

Comments
 (0)