Update jsoniter number parser implementation to match jsoniter-circe - #3052
Update jsoniter number parser implementation to match jsoniter-circe#3052kyri-petrou wants to merge 3 commits into
Conversation
|
I'm going to add |
|
I've released v2.39.0 with That already speeds up and simplifies circe booster: plokhotnyuk/jsoniter-scala@870a1f1 The next step will be improving @kyri-petrou @ghostdogpr Thanks for your support and donations! |
| case l: java.lang.Long => | ||
| val asLong = l.longValue() | ||
| val asInt = asLong.toInt | ||
| // Check if the number can fit in an Int (most common case) | ||
| if (asInt.toLong == asLong) Value.IntValue.IntNumber(asInt) | ||
| else Value.IntValue.LongNumber(asLong) | ||
| case bd: java.math.BigDecimal => | ||
| Value.FloatValue.BigDecimalNumber(bd) | ||
| case bi: java.math.BigInteger => | ||
| Value.IntValue.BigIntNumber(bi) |
There was a problem hiding this comment.
@plokhotnyuk I'm guessing that you're not planning on returning any other instances of java.lang.Number in the future, is that right?
If that's the case, it might be worth to document this in the scaladoc of readNumber. Or if you're planning on returning any different types, let me know so I can add a default case
Seems the code we were using is a bit outdated, I updated to match what's also found in jsoniter-circe now