1 /* mpn_subcnd_n -- Compute R = U - V if CND != 0 or R = U if CND == 0.
3 THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
4 SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
6 Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2008, 2009 Free Software
9 This file is part of the GNU MP Library.
11 The GNU MP Library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 The GNU MP Library is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
28 #if GMP_NAIL_BITS == 0
31 mpn_subcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
33 mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
36 ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
37 ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
39 mask = -(mp_limb_t) (cnd != 0);
59 #if GMP_NAIL_BITS >= 1
62 mpn_subcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
64 mp_limb_t ul, vl, rl, cy, mask;
67 ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
68 ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
70 mask = -(mp_limb_t) (cnd != 0);
77 cy = rl >> (GMP_LIMB_BITS - 1);
78 *rp++ = rl & GMP_NUMB_MASK;