From: Paul Eggert Date: Sat, 24 Aug 2019 19:45:36 +0000 (-0700) Subject: Tweak integer mod performance X-Git-Tag: emacs-27.0.90~1328^2~84 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2f7ca4020e4f1e30b263758439dba55551f0675d;p=emacs.git 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. --- 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) { mpz_t const *ym = bignum_integer (&mpz[1], y); bool neg_y = mpz_sgn (*ym) < 0; - mpz_mod (mpz[0], *bignum_integer (&mpz[0], x), *ym); + mpz_tdiv_r (mpz[0], *bignum_integer (&mpz[0], x), *ym); /* Fix the sign if needed. */ int sgn_r = mpz_sgn (mpz[0]);