From 1d8797876abff4ec8d76146e0013dc6551b070f7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Apr 2020 13:24:56 -0700 Subject: [PATCH] Fixed implicit linkage to ftol2() on Windows --- src/stdlib/SDL_stdlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index 848a1fd05..22eab5b02 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -266,8 +266,11 @@ SDL_trunc(double x) #if defined(HAVE_TRUNC) return trunc(x); #else - /* !!! FIXME: there are more formal (correct!) ways to do this. */ - return (double) ((Sint64) x); + if (x >= 0.0f) { + return SDL_floor(x); + } else { + return SDL_ceil(x); + } #endif }