1170809Sdelphij/* mpn_com - complement an mpn.
2170809Sdelphij
3170809SdelphijCopyright 2009 Free Software Foundation, Inc.
4170809Sdelphij
5170809SdelphijThis file is part of the GNU MP Library.
6170809Sdelphij
7170809SdelphijThe GNU MP Library is free software; you can redistribute it and/or modify
8170809Sdelphijit under the terms of either:
9170809Sdelphij
10170809Sdelphij  * the GNU Lesser General Public License as published by the Free
11170809Sdelphij    Software Foundation; either version 3 of the License, or (at your
12170809Sdelphij    option) any later version.
13170809Sdelphij
14170809Sdelphijor
15170809Sdelphij
16170809Sdelphij  * the GNU General Public License as published by the Free Software
17170809Sdelphij    Foundation; either version 2 of the License, or (at your option) any
18170809Sdelphij    later version.
19170809Sdelphij
20170809Sdelphijor both in parallel, as here.
21170809Sdelphij
22170809SdelphijThe GNU MP Library is distributed in the hope that it will be useful, but
23170809SdelphijWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24170809Sdelphijor FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25170809Sdelphijfor more details.
26170809Sdelphij
27170809SdelphijYou should have received copies of the GNU General Public License and the
28170809SdelphijGNU Lesser General Public License along with the GNU MP Library.  If not,
29170809Sdelphijsee https://www.gnu.org/licenses/.  */
30170809Sdelphij
31170809Sdelphij#include "gmp-impl.h"
32170809Sdelphij
33170809Sdelphij#undef mpn_com
34170809Sdelphij#define mpn_com __MPN(com)
35170809Sdelphij
36170809Sdelphijvoid
37170809Sdelphijmpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
38170809Sdelphij{
39170809Sdelphij  mp_limb_t ul;
40170809Sdelphij  do {
41170809Sdelphij      ul = *up++;
42170809Sdelphij      *rp++ = ~ul & GMP_NUMB_MASK;
43170809Sdelphij  } while (--n != 0);
44170809Sdelphij}
45170809Sdelphij