Skip to content

Commit

Permalink
Optimize asFallback() allocs (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
neal authored May 15, 2023
1 parent b7d3820 commit 3bc6300
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3bc6300

Please sign in to comment.