Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Remove unneeded cmp in Ceil and marshalTo #19467

Merged
merged 3 commits into from
Feb 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove one unneeded Cmp call from Dec
  • Loading branch information
ValarDragon committed Feb 19, 2024
commit 8856a422d200a9207539e41a5ed4ed580b36f39e
6 changes: 2 additions & 4 deletions math/dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,9 @@ func (d LegacyDec) Ceil() LegacyDec {
quo, rem = quo.QuoRem(tmp, precisionReuse, rem)

// no need to round with a zero remainder regardless of sign
if rem.Cmp(zeroInt) == 0 {
if rem.Sign() == 0 {
return LegacyNewDecFromBigInt(quo)
}

if rem.Sign() == -1 {
} else if rem.Sign() == -1 {
return LegacyNewDecFromBigInt(quo)
}

Expand Down