14a1767b4Smrg /* mpn_addmul_1 for Cray PVP.
24a1767b4Smrg
34a1767b4Smrg Copyright 1996, 2000, 2001 Free Software Foundation, Inc.
44a1767b4Smrg
54a1767b4Smrg This file is part of the GNU MP Library.
64a1767b4Smrg
74a1767b4Smrg The GNU MP Library is free software; you can redistribute it and/or modify
8*f81b1c5bSmrg it under the terms of either:
9*f81b1c5bSmrg
10*f81b1c5bSmrg * the GNU Lesser General Public License as published by the Free
11*f81b1c5bSmrg Software Foundation; either version 3 of the License, or (at your
124a1767b4Smrg option) any later version.
134a1767b4Smrg
14*f81b1c5bSmrg or
15*f81b1c5bSmrg
16*f81b1c5bSmrg * the GNU General Public License as published by the Free Software
17*f81b1c5bSmrg Foundation; either version 2 of the License, or (at your option) any
18*f81b1c5bSmrg later version.
19*f81b1c5bSmrg
20*f81b1c5bSmrg or both in parallel, as here.
21*f81b1c5bSmrg
224a1767b4Smrg The GNU MP Library is distributed in the hope that it will be useful, but
234a1767b4Smrg WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24*f81b1c5bSmrg or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25*f81b1c5bSmrg for more details.
264a1767b4Smrg
27*f81b1c5bSmrg You should have received copies of the GNU General Public License and the
28*f81b1c5bSmrg GNU Lesser General Public License along with the GNU MP Library. If not,
29*f81b1c5bSmrg see https://www.gnu.org/licenses/. */
304a1767b4Smrg
314a1767b4Smrg
324a1767b4Smrg #include "gmp-impl.h"
334a1767b4Smrg
344a1767b4Smrg mp_limb_t
mpn_addmul_1(mp_ptr rp,mp_srcptr up,mp_size_t n,mp_limb_t limb)354a1767b4Smrg mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t limb)
364a1767b4Smrg {
374a1767b4Smrg mp_limb_t p0[n], p1[n], tp[n];
384a1767b4Smrg mp_limb_t cy_limb;
394a1767b4Smrg
404a1767b4Smrg GMPN_MULWW (p1, p0, up, &n, &limb);
414a1767b4Smrg cy_limb = mpn_add_n (tp, rp, p0, n);
424a1767b4Smrg rp[0] = tp[0];
434a1767b4Smrg if (n != 1)
444a1767b4Smrg cy_limb += mpn_add_n (rp + 1, tp + 1, p1, n - 1);
454a1767b4Smrg cy_limb += p1[n - 1];
464a1767b4Smrg
474a1767b4Smrg return cy_limb;
484a1767b4Smrg }
49