summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2018-01-16 07:29:35 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2018-01-16 07:29:35 +0100
commitb38c9921647084a1079417d546c380113755bd98 (patch)
tree1417855561044340dbd9d4e15cbebecc620c7ee6 /mpz
parent7ebff6f44bfdabce836071566fcd866067e883fd (diff)
downloadgmp-b38c9921647084a1079417d546c380113755bd98.tar.gz
mpz/ior.c: Use MPZ_REALLOC
Diffstat (limited to 'mpz')
-rw-r--r--mpz/ior.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/mpz/ior.c b/mpz/ior.c
index 3bd34e66c..c238eea96 100644
--- a/mpz/ior.c
+++ b/mpz/ior.c
@@ -41,7 +41,6 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mp_size_t i;
TMP_DECL;
- TMP_MARK;
op1_size = SIZ(op1);
op2_size = SIZ(op2);
@@ -71,6 +70,7 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
}
else
{
+ TMP_MARK;
if (op1_size < 0)
{
mp_ptr opx, opy;
@@ -123,7 +123,6 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
mp_ptr opx;
mp_limb_t cy;
- mp_size_t res_alloc;
mp_size_t count;
/* Operand 2 negative, so will be the result.
@@ -133,20 +132,14 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
op2_size = -op2_size;
- res_alloc = op2_size;
+ res_ptr = MPZ_REALLOC (res, op2_size);
+ op1_ptr = PTR(op1);
opx = TMP_ALLOC_LIMBS (op2_size);
mpn_sub_1 (opx, PTR(op2), op2_size, (mp_limb_t) 1);
op2_ptr = opx;
op2_size -= op2_ptr[op2_size - 1] == 0;
- if (UNLIKELY (ALLOC(res) < res_alloc))
- {
- res_ptr = (mp_ptr) _mpz_realloc (res, res_alloc);
- op1_ptr = PTR(op1);
- /* op2_ptr points to temporary space. */
- }
-
if (op1_size >= op2_size)
{
/* We can just ignore the part of OP1 that stretches above OP2,