1 /* mpn_divrem_1(quot_ptr, qsize, dividend_ptr, dividend_size, divisor_limb) --
2 Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB.
3 Write DIVIDEND_SIZE limbs of quotient at QUOT_PTR.
4 Return the single-limb remainder.
5 There are no constraints on the value of the divisor.
7 QUOT_PTR and DIVIDEND_PTR might point to the same limb.
9 Copyright (C) 1996 Free Software Foundation, Inc.
11 This file is part of the GNU MP Library.
13 The GNU MP Library is free software; you can redistribute it and/or modify
14 it under the terms of the GNU Library General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or (at your
16 option) any later version.
18 The GNU MP Library is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
21 License for more details.
23 You should have received a copy of the GNU Library General Public License
24 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
25 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 MA 02111-1307, USA. */
34 mpn_divrem_1 (mp_ptr qp, mp_size_t qsize,
35 mp_srcptr dividend_ptr, mp_size_t dividend_size,
36 mp_limb_t divisor_limb)
38 mpn_divrem_1 (qp, qsize, dividend_ptr, dividend_size, divisor_limb)
41 mp_srcptr dividend_ptr;
42 mp_size_t dividend_size;
43 mp_limb_t divisor_limb;
49 /* Develop integer part of quotient. */
50 rlimb = mpn_divmod_1 (qp + qsize, dividend_ptr, dividend_size, divisor_limb);
54 for (i = qsize - 1; i >= 0; i--)
55 udiv_qrnnd (qp[i], rlimb, rlimb, 0, divisor_limb);