1 /* mpn_nussbaumer_mul -- Multiply {ap,an} and {bp,bn} using
2 Nussbaumer's negacyclic convolution.
4 Contributed to the GNU project by Marco Bodrato.
6 THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY
7 SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
8 GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
10 Copyright 2009 Free Software Foundation, Inc.
12 This file is part of the GNU MP Library.
14 The GNU MP Library is free software; you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or (at your
17 option) any later version.
19 The GNU MP Library is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
22 License for more details.
24 You should have received a copy of the GNU Lesser General Public License
25 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
31 /* Multiply {ap,an} by {bp,bn}, and put the result in {pp, an+bn} */
33 mpn_nussbaumer_mul (mp_ptr pp,
34 mp_srcptr ap, mp_size_t an,
35 mp_srcptr bp, mp_size_t bn)
46 if ((ap == bp) && (an == bn))
48 rn = mpn_sqrmod_bnm1_next_size (2*an);
49 tp = TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (rn, an));
50 mpn_sqrmod_bnm1 (pp, rn, ap, an, tp);
54 rn = mpn_mulmod_bnm1_next_size (an + bn);
55 tp = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (rn, an, bn));
56 mpn_mulmod_bnm1 (pp, rn, ap, an, bp, bn, tp);