mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-20 11:48:29 +00:00
stdlib: Add SDL_trunc and SDL_truncf
This commit is contained in:
parent
a791689086
commit
d292f6bd4f
7 changed files with 32 additions and 4 deletions
|
@ -260,6 +260,27 @@ SDL_floorf(float x)
|
|||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
SDL_truncf(float x)
|
||||
{
|
||||
#if defined(HAVE_TRUNCF)
|
||||
return truncf(x);
|
||||
#else
|
||||
return (float)SDL_trunc((double)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
SDL_fmod(double x, double y)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue