diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/timefns.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/timefns.c b/src/timefns.c index 0df7d1f4363..ba1ba10a809 100644 --- a/src/timefns.c +++ b/src/timefns.c | |||
| @@ -774,8 +774,8 @@ ticks_hz_hz_ticks (struct ticks_hz t, Lisp_Object hz) | |||
| 774 | if (XFIXNUM (hz) <= 0) | 774 | if (XFIXNUM (hz) <= 0) |
| 775 | invalid_hz (hz); | 775 | invalid_hz (hz); |
| 776 | 776 | ||
| 777 | /* For speed, use intmax_t arithmetic if it will do. */ | 777 | /* Prefer non-bignum arithmetic to speed up common cases. */ |
| 778 | if (FASTER_TIMEFNS && FIXNUMP (t.ticks) && FIXNUMP (t.hz)) | 778 | if (FASTER_TIMEFNS && FIXNUMP (t.hz)) |
| 779 | { | 779 | { |
| 780 | /* Reduce T.hz and HZ by their GCD, to avoid some intmax_t | 780 | /* Reduce T.hz and HZ by their GCD, to avoid some intmax_t |
| 781 | overflows that would occur in T.ticks * HZ. */ | 781 | overflows that would occur in T.ticks * HZ. */ |
| @@ -784,9 +784,12 @@ ticks_hz_hz_ticks (struct ticks_hz t, Lisp_Object hz) | |||
| 784 | ithz /= d; | 784 | ithz /= d; |
| 785 | ihz /= d; | 785 | ihz /= d; |
| 786 | 786 | ||
| 787 | intmax_t ticks; | 787 | if (FIXNUMP (t.ticks)) |
| 788 | if (!ckd_mul (&ticks, XFIXNUM (t.ticks), ihz)) | 788 | { |
| 789 | return make_int (ticks / ithz - (ticks % ithz < 0)); | 789 | intmax_t ticks; |
| 790 | if (!ckd_mul (&ticks, XFIXNUM (t.ticks), ihz)) | ||
| 791 | return make_int (ticks / ithz - (ticks % ithz < 0)); | ||
| 792 | } | ||
| 790 | 793 | ||
| 791 | t.hz = make_fixnum (ithz); | 794 | t.hz = make_fixnum (ithz); |
| 792 | hz = make_fixnum (ihz); | 795 | hz = make_fixnum (ihz); |