0
0
mirror of https://github.com/vim/vim.git synced 2025-09-03 21:23:48 -04:00

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 #12412)
This commit is contained in:
Isao Sato 2023-05-19 13:20:34 +01:00 committed by Bram Moolenaar
parent 74ccbb1f7d
commit d13c254d10
2 changed files with 5 additions and 2 deletions

View File

@ -123,10 +123,11 @@ profile_setlimit(long msec, proftime_T *tm)
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

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1567,
/**/
1566,
/**/