summaryrefslogtreecommitdiff
path: root/mul_ui.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-08-27 14:09:13 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-08-27 14:09:13 +0000
commit567738044d5081848b63851511f8a849862950be (patch)
tree4412440b5fea2133ec670e01046c0c7b4eb35779 /mul_ui.c
parent6d8d0c8a5a49ba8eec14c8529e635f431a049d74 (diff)
downloadmpfr-567738044d5081848b63851511f8a849862950be.tar.gz
was completely wrong for ysize > xsize
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1148 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul_ui.c')
-rw-r--r--mul_ui.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mul_ui.c b/mul_ui.c
index fbd1696ac..afda14834 100644
--- a/mul_ui.c
+++ b/mul_ui.c
@@ -28,9 +28,9 @@ MA 02111-1307, USA. */
void
#if __STDC__
-mpfr_mul_ui(mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
+mpfr_mul_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
#else
-mpfr_mul_ui(y, x, u, rnd_mode)
+mpfr_mul_ui (y, x, u, rnd_mode)
mpfr_ptr y;
mpfr_srcptr x;
unsigned long int u;
@@ -82,8 +82,7 @@ mpfr_mul_ui(y, x, u, rnd_mode)
else
dif = ysize - xsize;
- carry = mpn_mul_1 (my + dif, MPFR_MANT(x), xsize, u);
- MPN_ZERO(my, dif);
+ carry = mpn_mul_1 (my, MPFR_MANT(x), xsize, u);
/* WARNING: count_leading_zeros is undefined for carry=0 */
if (carry)
@@ -136,7 +135,7 @@ mpfr_mul_ui(y, x, u, rnd_mode)
my[ysize - 1] |= (carry << cnt);
}
MPFR_EXP(y) = ex + BITS_PER_MP_LIMB - cnt;
- if (ysize < xsize) MPN_COPY(old_my, my, ysize);
+ if (ysize < xsize) MPN_COPY(old_my, my + xsize - ysize, ysize);
/* set sign */
if (MPFR_SIGN(y) * MPFR_SIGN(x) < 0) MPFR_CHANGE_SIGN(y);
TMP_FREE(marker);