summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpz/tdiv_q_ui.c8
-rw-r--r--mpz/tdiv_qr_ui.c4
-rw-r--r--mpz/tdiv_r_ui.c4
3 files changed, 12 insertions, 4 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;
}
diff --git a/mpz/tdiv_qr_ui.c b/mpz/tdiv_qr_ui.c
index 411243261..96633124c 100644
--- a/mpz/tdiv_qr_ui.c
+++ b/mpz/tdiv_qr_ui.c
@@ -24,7 +24,7 @@ MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-void
+unsigned long int
#if __STDC__
mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
#else
@@ -71,4 +71,6 @@ mpz_tdiv_qr_ui (quot, rem, dividend, 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;
}
diff --git a/mpz/tdiv_r_ui.c b/mpz/tdiv_r_ui.c
index d93748ae7..161f02a7a 100644
--- a/mpz/tdiv_r_ui.c
+++ b/mpz/tdiv_r_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_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
#else
@@ -58,4 +58,6 @@ mpz_tdiv_r_ui (rem, dividend, divisor)
rem->_mp_size = dividend_size >= 0 ? 1 : -1;
rem->_mp_d[0] = remainder_limb;
}
+
+ return remainder_limb;
}