1
/* mpn_addmul_1 -- multiply the N long limb vector pointed to by UP by VL,
2
add the N least significant limbs of the product to the limb vector
3
pointed to by RP. Return the most significant limb of the product,
4
adjusted for carry-out from the addition.
6
Copyright 1992, 1993, 1994, 1996, 2000, 2002 Free Software Foundation, Inc.
8
This file is part of the GNU MP Library.
10
The GNU MP Library is free software; you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation; either version 2.1 of the License, or (at your
13
option) any later version.
15
The GNU MP Library is distributed in the hope that it will be useful, but
16
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18
License for more details.
20
You should have received a copy of the GNU Lesser General Public License
21
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
22
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23
MA 02111-1307, USA. */
30
#if GMP_NAIL_BITS == 0
33
mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
35
mp_limb_t ul, cl, hpl, lpl, rl;
38
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
44
umul_ppmm (hpl, lpl, ul, vl);
47
cl = (lpl < cl) + hpl;
61
#if GMP_NAIL_BITS == 1
65
#if GMP_NAIL_BITS >= 2
68
mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
70
mp_limb_t shifted_vl, ul, rl, lpl, hpl, prev_hpl, xw, cl, xl;
73
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
78
shifted_vl = vl << GMP_NAIL_BITS;
85
umul_ppmm (hpl, lpl, ul, shifted_vl);
86
lpl >>= GMP_NAIL_BITS;
87
xw = prev_hpl + lpl + rl + cl;
88
cl = xw >> GMP_NUMB_BITS;
89
xl = xw & GMP_NUMB_MASK;