=================================================================== RCS file: /home/cvs/OpenXM_contrib/gmp/mpn/generic/Attic/mod_1.c,v retrieving revision 1.1 retrieving revision 1.1.1.2 diff -u -p -r1.1 -r1.1.1.2 --- OpenXM_contrib/gmp/mpn/generic/Attic/mod_1.c 2000/01/10 15:35:23 1.1 +++ OpenXM_contrib/gmp/mpn/generic/Attic/mod_1.c 2000/09/09 14:12:26 1.1.1.2 @@ -3,21 +3,21 @@ Return the single-limb remainder. There are no constraints on the value of the divisor. -Copyright (C) 1991, 1993, 1994, Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1999 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU MP Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -You should have received a copy of the GNU Library General Public License +You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -34,9 +34,6 @@ MA 02111-1307, USA. */ #define UDIV_TIME UMUL_TIME #endif -/* FIXME: We should be using invert_limb (or invert_normalized_limb) - here (not udiv_qrnnd). */ - mp_limb_t #if __STDC__ mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size, @@ -74,18 +71,8 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb) mp_limb_t divisor_limb_inverted; divisor_limb <<= normalization_steps; + invert_limb (divisor_limb_inverted, divisor_limb); - /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The - result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the - most significant bit (with weight 2**N) implicit. */ - - /* Special case for DIVISOR_LIMB == 100...000. */ - if (divisor_limb << 1 == 0) - divisor_limb_inverted = ~(mp_limb_t) 0; - else - udiv_qrnnd (divisor_limb_inverted, dummy, - -divisor_limb, 0, divisor_limb); - n1 = dividend_ptr[dividend_size - 1]; r = n1 >> (BITS_PER_MP_LIMB - normalization_steps); @@ -113,16 +100,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb) { mp_limb_t divisor_limb_inverted; - /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The - result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the - most significant bit (with weight 2**N) implicit. */ - - /* Special case for DIVISOR_LIMB == 100...000. */ - if (divisor_limb << 1 == 0) - divisor_limb_inverted = ~(mp_limb_t) 0; - else - udiv_qrnnd (divisor_limb_inverted, dummy, - -divisor_limb, 0, divisor_limb); + invert_limb (divisor_limb_inverted, divisor_limb); i = dividend_size - 1; r = dividend_ptr[i];