summaryrefslogtreecommitdiff
path: root/mpz/cfdiv_r_2exp.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2012-05-26 15:57:43 +0200
committerTorbjorn Granlund <tege@gmplib.org>2012-05-26 15:57:43 +0200
commiteb3632bb2177f6ea7d2f41c9722458c10159c013 (patch)
tree624a47bf95ce22460938a693f797937f5d6003cb /mpz/cfdiv_r_2exp.c
parent27ac5bf5c349d49c7103674b4a366afb6ad51cca (diff)
downloadgmp-eb3632bb2177f6ea7d2f41c9722458c10159c013.tar.gz
Use MPZ_REALLOC return value when possible.
Diffstat (limited to 'mpz/cfdiv_r_2exp.c')
-rw-r--r--mpz/cfdiv_r_2exp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mpz/cfdiv_r_2exp.c b/mpz/cfdiv_r_2exp.c
index 8908fe9a9..205a7bd23 100644
--- a/mpz/cfdiv_r_2exp.c
+++ b/mpz/cfdiv_r_2exp.c
@@ -1,6 +1,6 @@
/* mpz_cdiv_r_2exp, mpz_fdiv_r_2exp -- remainder from mpz divided by 2^n.
-Copyright 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -67,8 +67,7 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
else
{
i = MIN (abs_usize, limb_cnt+1);
- MPZ_REALLOC (w, i);
- wp = PTR(w);
+ wp = MPZ_REALLOC (w, i);
MPN_COPY (wp, up, i);
/* if smaller than limb_cnt then only the copy is needed */
@@ -103,9 +102,8 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
negate:
/* twos complement negation to get 2**cnt-u */
- MPZ_REALLOC (w, limb_cnt+1);
+ wp = MPZ_REALLOC (w, limb_cnt+1);
up = PTR(u);
- wp = PTR(w);
/* Ones complement */
i = MIN (abs_usize, limb_cnt+1);