Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bénédikt Tran <[email protected]>
  • Loading branch information
skirpichev and picnixz authored Dec 14, 2024
1 parent c13b7d2 commit 589f926
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3680,8 +3680,8 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
return PyLong_FromInt64(val);
}

n = (mpd_sizeinbase(x, 2) +
layout->bits_per_digit - 1) / layout->bits_per_digit;
const uint8_t bpd = layout->bits_per_digit;
n = (mpd_sizeinbase(x, 2) + bpd - 1) / bpd;
PyLongWriter *writer = PyLongWriter_Create(mpd_isnegative(x), n,
(void**)&ob_digit);
/* mpd_sizeinbase can overestimate size by 1 digit, set it to zero. */
Expand Down

0 comments on commit 589f926

Please sign in to comment.