Skip to content

Commit 589f926

Browse files
skirpichevpicnixz
andauthored
Apply suggestions from code review
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent c13b7d2 commit 589f926

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/_decimal/_decimal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,8 +3680,8 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
36803680
return PyLong_FromInt64(val);
36813681
}
36823682

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

0 commit comments

Comments
 (0)