]> git.eshelyaron.com Git - emacs.git/commit
Reduce size of integer product in timefns
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 10 Jul 2024 00:37:55 +0000 (02:37 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 11 Jul 2024 14:39:47 +0000 (16:39 +0200)
commit502640a3ebbf6c89fe339df411367e5df26fba2f
treefe85c709cf046b73b8d0a0a6f6a96a9d072a1f13
parent6cc14dcd992dbf0359bd4abc6e1e2f5713636e21
Reduce size of integer product in timefns

* src/timefns.c (emacs_gcd): New static function.
(ticks_hz_hz_ticks): Use it to reduce the size of the integer
product in the common case when converting from ns to ps.  For
that, we need to multiply t.ticks only by 10³, not multiply by
10¹² and then divide by 10⁹.  This avoids the need to use bignums
in a significant number of cases.

(cherry picked from commit 6ef052d9b23aef3f34d19e5d93d97884215d1465)
src/timefns.c