summaryrefslogtreecommitdiff
path: root/gmp/mpf/div_ui.c
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-05-27 17:39:31 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-05-27 17:53:32 +0100
commit26c75cf8267919f81a1759c9c965a52c660233f9 (patch)
treecf2a39cf56c2c8ac45760854413ab233e6263974 /gmp/mpf/div_ui.c
parent56892c1d217baea02092b51a09bbc924130ca84c (diff)
downloadgcc-tarball-26c75cf8267919f81a1759c9c965a52c660233f9.tar.gz
Diffstat (limited to 'gmp/mpf/div_ui.c')
-rw-r--r--gmp/mpf/div_ui.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/gmp/mpf/div_ui.c b/gmp/mpf/div_ui.c
index 9be7e680be..bcf2b699cc 100644
--- a/gmp/mpf/div_ui.c
+++ b/gmp/mpf/div_ui.c
@@ -1,33 +1,22 @@
/* mpf_div_ui -- Divide a float with an unsigned integer.
-Copyright 1993, 1994, 1996, 2000-2002, 2004, 2005, 2012 Free Software
+Copyright 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2005 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@@ -61,10 +50,13 @@ mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
}
#endif
- if (UNLIKELY (v == 0))
- DIVIDE_BY_ZERO;
-
usize = u->_mp_size;
+ sign_quotient = usize;
+ usize = ABS (usize);
+ prec = r->_mp_prec;
+
+ if (v == 0)
+ DIVIDE_BY_ZERO;
if (usize == 0)
{
@@ -73,17 +65,13 @@ mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
return;
}
- sign_quotient = usize;
- usize = ABS (usize);
- prec = r->_mp_prec;
-
TMP_MARK;
rp = r->_mp_d;
up = u->_mp_d;
tsize = 1 + prec;
- tp = TMP_ALLOC_LIMBS (tsize + 1);
+ tp = (mp_ptr) TMP_ALLOC ((tsize + 1) * BYTES_PER_MP_LIMB);
if (usize > tsize)
{