Mercurial > vim
changeset 32471:d863a33cb220 v9.0.1567
patch 9.0.1567: profiler calculation may be wrong on 32 bit builds
Commit: https://github.com/vim/vim/commit/d13c254d100509271b37d609c19e45c857352181
Author: Isao Sato <svardew@gmail.com>
Date: Fri May 19 13:20:34 2023 +0100
patch 9.0.1567: profiler calculation may be wrong on 32 bit builds
Problem: Profiler calculation may be wrong on 32 bit builds.
Solution: Use 64 bit variable if possible. (Isao Sato, closes https://github.com/vim/vim/issues/12412)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 May 2023 14:30:05 +0200 |
parents | 63305439430b |
children | bc0e1a97d4e0 |
files | src/profiler.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/profiler.c +++ b/src/profiler.c @@ -123,10 +123,11 @@ profile_setlimit(long msec, proftime_T * QueryPerformanceFrequency(&fr); tm->QuadPart += (LONGLONG)((double)msec / 1000.0 * (double)fr.QuadPart); # else - long fsec; + varnumber_T fsec; // this should be 64 bit if possible PROF_GET_TIME(tm); - fsec = (long)tm->tv_fsec + (long)msec * (TV_FSEC_SEC / 1000); + fsec = (varnumber_T)tm->tv_fsec + + (varnumber_T)msec * (varnumber_T)(TV_FSEC_SEC / 1000); tm->tv_fsec = fsec % (long)TV_FSEC_SEC; tm->tv_sec += fsec / (long)TV_FSEC_SEC; # endif