summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsao Sato <svardew@gmail.com>2023-05-19 13:20:34 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-19 13:20:34 +0100
commitd13c254d100509271b37d609c19e45c857352181 (patch)
treec3aea40b7e92962f0f62bbf6a510849fc2258488
parent74ccbb1f7df5bd5e5bd50dd7fe4ae9799da50274 (diff)
patch 9.0.1567: profiler calculation may be wrong on 32 bit buildsv9.0.1567
Problem: Profiler calculation may be wrong on 32 bit builds. Solution: Use 64 bit variable if possible. (Isao Sato, closes #12412)
-rw-r--r--src/profiler.c5
-rw-r--r--src/version.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 3d37a64562..e101067ce8 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -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
diff --git a/src/version.c b/src/version.c
index 10e01447f1..42c2c0faed 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1567,
+/**/
1566,
/**/
1565,