aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert2019-08-24 12:45:36 -0700
committerPaul Eggert2019-08-24 15:55:09 -0700
commit2f7ca4020e4f1e30b263758439dba55551f0675d (patch)
tree883f4ae8f1ec06e480838bea3f504e6ae60fdc4c /src/data.c
parent575179f74d9b80ee468ae39239c853546da8de43 (diff)
downloademacs-2f7ca4020e4f1e30b263758439dba55551f0675d.tar.gz
emacs-2f7ca4020e4f1e30b263758439dba55551f0675d.zip
Tweak integer mod performance
* src/data.c (integer_mod): Use mpz_tdiv_r not mpz_mod, as that’s more similar to the fixnum case, is a bit more efficient, and otherwise the later ‘sgn_r < 0’ code is useless anyway.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c
index dfc8a892f5e..cb25fce014a 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3098,7 +3098,7 @@ integer_mod (Lisp_Object x, Lisp_Object y)
3098 { 3098 {
3099 mpz_t const *ym = bignum_integer (&mpz[1], y); 3099 mpz_t const *ym = bignum_integer (&mpz[1], y);
3100 bool neg_y = mpz_sgn (*ym) < 0; 3100 bool neg_y = mpz_sgn (*ym) < 0;
3101 mpz_mod (mpz[0], *bignum_integer (&mpz[0], x), *ym); 3101 mpz_tdiv_r (mpz[0], *bignum_integer (&mpz[0], x), *ym);
3102 3102
3103 /* Fix the sign if needed. */ 3103 /* Fix the sign if needed. */
3104 int sgn_r = mpz_sgn (mpz[0]); 3104 int sgn_r = mpz_sgn (mpz[0]);