From 3bc630043bc2b2152b2e504980ea871b277c9833 Mon Sep 17 00:00:00 2001 From: Neal Patel Date: Mon, 15 May 2023 11:54:58 -0500 Subject: [PATCH] Optimize asFallback() allocs (#6) --- decimal.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/decimal.go b/decimal.go index 256f36a..ecb236a 100644 --- a/decimal.go +++ b/decimal.go @@ -1189,8 +1189,7 @@ func parseFixed[T string | []byte](v T) (int64, bool) { func (d Decimal) asFallback() decimal.Decimal { if d.fallback == nil { - x := big.NewInt(d.fixed) - return decimal.NewFromBigInt(x, -12) + return decimal.New(d.fixed, -precision) } return *d.fallback }