summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpz.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/mpz.c b/py/mpz.c
index 3c20023bc5..3bd3090411 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -1441,8 +1441,8 @@ void mpz_as_bytes(const mpz_t *z, bool big_endian, mp_uint_t len, byte *buf) {
for (; bits >= 8; bits -= 8, d >>= 8) {
mpz_dig_t val = d;
if (z->neg) {
- d = (~d & 0xff) + carry;
- carry = d >> 8;
+ val = (~val & 0xff) + carry;
+ carry = val >> 8;
}
if (big_endian) {
*--b = val;