Do this by rounding the final floating-point value to the nearest
integer rather than simply casting to int. Thanks to Elviz for
finding and debugging this.
(Also, it sucks to have to reimplement parts of C99.)
git-svn-id: https://s.snth.net/svn/neverball/trunk@3460
78b8d119-cf0a-0410-b17c-
f493084dd1d7
(src), \
MAX(0, MAXSTRLEN(dst) - strlen(dst))))
-#define TIME_TO_MS(t) ((int) ((t) * 1000.0f))
+#define SIGN(n) ((n) < 0 ? -1 : ((n) ? +1 : 0))
+#define ROUND(f) ((int) ((f) + 0.5f * SIGN(f)))
+
+#define TIME_TO_MS(t) ROUND((t) * 1000.0f)
#define MS_TO_TIME(m) ((m) * 0.001f)
int read_line(char **, fs_file);