Skip to content

Commit 89ad39b

Browse files
committed
Remove optimizations based on implementation details
1 parent 0b1fe9d commit 89ad39b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

library/src/scala/quoted/Liftable.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,14 @@ object Liftable {
233233
}
234234

235235
given as Liftable[BigInt] = new Liftable[BigInt] {
236-
def toExpr(x: BigInt): given QuoteContext => Expr[BigInt] = {
237-
lazy val xInt: Int = x.intValue()
238-
if (x.isValidInt && -1024 <= xInt && xInt < 1024) '{ BigInt(${xInt.toExpr}) } // Cached BigInt
239-
else '{ BigInt(${x.toString(Character.MAX_RADIX).toExpr}, ${Character.MAX_RADIX.toExpr}) } // Compact string BigInt
240-
}
236+
def toExpr(x: BigInt): given QuoteContext => Expr[BigInt] =
237+
'{ BigInt(${x.toString(Character.MAX_RADIX).toExpr}, ${Character.MAX_RADIX.toExpr}) }
241238
}
242239

243240
/** Lift a BigDecimal using the default MathContext */
244241
given as Liftable[BigDecimal] = new Liftable[BigDecimal] {
245-
def toExpr(x: BigDecimal): given QuoteContext => Expr[BigDecimal] = {
246-
lazy val xInt: Int = x.intValue()
247-
if (x.isValidInt && -512 <= xInt && xInt < 512) '{ BigDecimal(${xInt.toExpr}) } // Cached BigDecimal
248-
else '{ BigDecimal(${x.toString.toExpr}) }
249-
}
242+
def toExpr(x: BigDecimal): given QuoteContext => Expr[BigDecimal] =
243+
'{ BigDecimal(${x.toString.toExpr}) }
250244
}
251245

252246
}

0 commit comments

Comments
 (0)