~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/mpz/cdiv_ui.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
   always fit into the return type, the negative of the true remainder is
4
4
   returned.
5
5
 
6
 
Copyright 1994, 1995, 1996, 2001, 2002 Free Software Foundation, Inc.
 
6
Copyright 1994, 1995, 1996, 2001, 2002, 2004, 2005 Free Software Foundation,
 
7
Inc.
7
8
 
8
9
This file is part of the GNU MP Library.
9
10
 
19
20
 
20
21
You should have received a copy of the GNU Lesser General Public License
21
22
along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
22
 
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23
 
MA 02111-1307, USA. */
 
23
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
24
MA 02110-1301, USA. */
24
25
 
25
26
#include "gmp.h"
26
27
#include "gmp-impl.h"
43
44
 
44
45
  nn = ABS(ns);
45
46
  np = PTR(dividend);
46
 
#if GMP_NAIL_BITS != 0
 
47
#if BITS_PER_ULONG > GMP_NUMB_BITS  /* avoid warnings about shift amount */
47
48
  if (divisor > GMP_NUMB_MAX)
48
49
    {
49
50
      mp_limb_t dp[2], rp[2];
50
51
      mp_ptr qp;
51
52
      mp_size_t rn;
52
 
      TMP_DECL (mark);
 
53
      TMP_DECL;
53
54
 
54
55
      if (nn == 1)              /* tdiv_qr requirements; tested above for 0 */
55
56
        {
58
59
        }
59
60
      else
60
61
        {
61
 
          TMP_MARK (mark);
 
62
          TMP_MARK;
62
63
          dp[0] = divisor & GMP_NUMB_MASK;
63
64
          dp[1] = divisor >> GMP_NUMB_BITS;
64
65
          qp = TMP_ALLOC_LIMBS (nn - 2 + 1);
65
66
          mpn_tdiv_qr (qp, rp, (mp_size_t) 0, np, nn, dp, (mp_size_t) 2);
66
 
          TMP_FREE (mark);
 
67
          TMP_FREE;
67
68
          rl = rp[0] + (rp[1] << GMP_NUMB_BITS);
68
69
        }
69
70