summaryrefslogtreecommitdiff
path: root/mpz/tdiv_q_ui.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1998-05-05 01:47:03 +0200
committertege <tege@gmplib.org>1998-05-05 01:47:03 +0200
commitb7dc3eeb264481185d60a22a59cf187c6a974d8b (patch)
tree7bd7da9350fa8c103e4041ca49650710059c7ec0 /mpz/tdiv_q_ui.c
parent56d1f8704f7190ab52199af76decd98b81841ea3 (diff)
downloadgmp-b7dc3eeb264481185d60a22a59cf187c6a974d8b.tar.gz
Return the remainder.
Diffstat (limited to 'mpz/tdiv_q_ui.c')
-rw-r--r--mpz/tdiv_q_ui.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mpz/tdiv_q_ui.c b/mpz/tdiv_q_ui.c
index 22d410fa5..9b6f302ac 100644
--- a/mpz/tdiv_q_ui.c
+++ b/mpz/tdiv_q_ui.c
@@ -23,7 +23,7 @@ MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-void
+unsigned long int
#if __STDC__
mpz_tdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
#else
@@ -36,6 +36,7 @@ mpz_tdiv_q_ui (quot, dividend, divisor)
mp_size_t dividend_size;
mp_size_t size;
mp_ptr quot_ptr;
+ mp_limb_t remainder_limb;
if (divisor == 0)
DIVIDE_BY_ZERO;
@@ -52,9 +53,12 @@ mpz_tdiv_q_ui (quot, dividend, divisor)
quot_ptr = quot->_mp_d;
- mpn_divmod_1 (quot_ptr, dividend->_mp_d, size, (mp_limb_t) divisor);
+ remainder_limb
+ = mpn_divmod_1 (quot_ptr, dividend->_mp_d, size, (mp_limb_t) divisor);
/* The quotient is SIZE limbs, but the most significant might be zero. */
size -= size != 0 && quot_ptr[size - 1] == 0;
quot->_mp_size = dividend_size >= 0 ? size : -size;
+
+ return remainder_limb;
}