Skip to content

Commit 59636f9

Browse files
committed
address review
1 parent 0fec6e1 commit 59636f9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Modules/_decimal/_decimal.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,15 +2336,16 @@ dec_from_long(decimal_state *state, PyTypeObject *type, PyObject *v,
23362336
}
23372337
if (export_long.digits) {
23382338
const PyLongLayout *layout = PyLong_GetNativeLayout();
2339-
uint32_t base = (uint32_t)1 << layout->bits_per_digit;
2340-
uint8_t sign = export_long.negative ? MPD_NEG : MPD_POS;
2341-
Py_ssize_t len = export_long.ndigits;
23422339

23432340
assert(layout->bits_per_digit < 32);
23442341
assert(layout->digits_order == -1);
23452342
assert(layout->digit_endianness == (PY_LITTLE_ENDIAN ? -1 : 1));
23462343
assert(layout->digit_size == 2 || layout->digit_size == 4);
23472344

2345+
uint32_t base = (uint32_t)1 << layout->bits_per_digit;
2346+
uint8_t sign = export_long.negative ? MPD_NEG : MPD_POS;
2347+
Py_ssize_t len = export_long.ndigits;
2348+
23482349
if (layout->digit_size == 4) {
23492350
mpd_qimport_u32(MPD(dec), export_long.digits, len, sign,
23502351
base, ctx, status);
@@ -3681,13 +3682,13 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
36813682
assert(!mpd_iszero(x));
36823683

36833684
const PyLongLayout *layout = PyLong_GetNativeLayout();
3684-
uint32_t base = (uint32_t)1 << layout->bits_per_digit;
36853685

36863686
assert(layout->bits_per_digit < 32);
36873687
assert(layout->digits_order == -1);
36883688
assert(layout->digit_endianness == (PY_LITTLE_ENDIAN ? -1 : 1));
36893689
assert(layout->digit_size == 2 || layout->digit_size == 4);
36903690

3691+
uint32_t base = (uint32_t)1 << layout->bits_per_digit;
36913692
size_t n, len = mpd_sizeinbase(x, base);
36923693
void *digits;
36933694
PyLongWriter *writer = PyLongWriter_Create(mpd_isnegative(x), len, &digits);

0 commit comments

Comments
 (0)