Import gmp-4.3.1
[dragonfly.git] / contrib / gmp / mpn / generic / mullow_basecase.c
1 /* mpn_mullow_basecase -- Internal routine to multiply two natural
2    numbers of length m and n and return the low part.
3
4    THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE.  IT IS ONLY
5    SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
6
7
8 Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
9
10 This file is part of the GNU MP Library.
11
12 The GNU MP Library is free software; you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or (at your
15 option) any later version.
16
17 The GNU MP Library is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
20 License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
24
25 #include "gmp.h"
26 #include "gmp-impl.h"
27
28 /*
29   FIXME: Should use mpn_addmul_2 (and higher).
30 */
31
32 void
33 mpn_mullow_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
34 {
35   mp_size_t i;
36
37   mpn_mul_1 (rp, up, n, vp[0]);
38
39   for (i = 1; i < n; i++)
40     mpn_addmul_1 (rp + i, up, n - i, vp[i]);
41 }