]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1567: profiler calculation may be wrong on 32 bit builds v9.0.1567
authorIsao Sato <svardew@gmail.com>
Fri, 19 May 2023 12:20:34 +0000 (13:20 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 19 May 2023 12:20:34 +0000 (13:20 +0100)
Problem:    Profiler calculation may be wrong on 32 bit builds.
Solution:   Use 64 bit variable if possible. (Isao Sato, closes #12412)

src/profiler.c
src/version.c

index 3d37a64562d6dd92f55de336eb01551ab14d152e..e101067ce8ab438008a575e0c2e791374deef2d2 100644 (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
index 10e01447f17be74a538ae5bab09383433c51a634..42c2c0faede6ca08bb44eb63617ca4b3824cbc56 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1567,
 /**/
     1566,
 /**/