Browse Source

Fixed implicit linkage to ftol2() on Windows

Sam Lantinga 5 years ago
parent
commit
1d8797876a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/stdlib/SDL_stdlib.c

+ 5 - 2
src/stdlib/SDL_stdlib.c

@@ -266,8 +266,11 @@ SDL_trunc(double x)
 #if defined(HAVE_TRUNC)
 #if defined(HAVE_TRUNC)
     return trunc(x);
     return trunc(x);
 #else
 #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
 #endif
 }
 }