[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 63906ab 5/5: Tweak time arithmetic performance
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 63906ab 5/5: Tweak time arithmetic performance |
Date: |
Sat, 24 Aug 2019 18:55:18 -0400 (EDT) |
branch: master
commit 63906ab4877b0f93e806a1a0b3b92ba8c8c67398
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Tweak time arithmetic performance
* src/timefns.c (time_arith): Prefer mpz_divexact to mpz_tdiv_q
when either will do.
---
src/timefns.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/timefns.c b/src/timefns.c
index 6c9473f..c1e3141 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1105,8 +1105,8 @@ time_arith (Lisp_Object a, Lisp_Object b, bool subtract)
/* fa = da/g, fb = db/g. */
mpz_t *fa = &mpz[4], *fb = &mpz[3];
- mpz_tdiv_q (*fa, *da, *g);
- mpz_tdiv_q (*fb, *db, *g);
+ mpz_divexact (*fa, *da, *g);
+ mpz_divexact (*fb, *db, *g);
/* ihz = fa * db. This is equal to lcm (da, db). */
mpz_t *ihz = &mpz[0];
@@ -1149,8 +1149,8 @@ time_arith (Lisp_Object a, Lisp_Object b, bool subtract)
if (!FASTER_TIMEFNS || mpz_cmp_ui (*ig, 1) > 0)
{
- mpz_tdiv_q (*iticks, *iticks, *ig);
- mpz_tdiv_q (*ihz, *ihz, *ig);
+ mpz_divexact (*iticks, *iticks, *ig);
+ mpz_divexact (*ihz, *ihz, *ig);
if (!FASTER_TIMEFNS || mpz_cmp (*ihz, *hzmin) < 0)
{