Added SDL_round(), contributed by Benoit Pierre - thanks!

This commit is contained in:
Sam Lantinga 2014-08-16 23:23:15 -07:00
parent 5619521805
commit 5acb7c63d1
19 changed files with 29 additions and 4 deletions

View file

@ -591,3 +591,4 @@
#define SDL_QueueAudio SDL_QueueAudio_REAL
#define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
#define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
#define SDL_round SDL_round_REAL

View file

@ -623,3 +623,4 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX2,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
SDL_DYNAPI_PROC(double,SDL_round,(double a),(a),return)

View file

@ -30,6 +30,7 @@ double SDL_uclibc_fabs(double x);
double SDL_uclibc_floor(double x);
double SDL_uclibc_log(double x);
double SDL_uclibc_pow(double x, double y);
double SDL_uclibc_round(double x);
double SDL_uclibc_scalbn(double x, int n);
double SDL_uclibc_sin(double x);
double SDL_uclibc_sqrt(double x);

View file

@ -37,6 +37,7 @@ typedef unsigned int u_int32_t;
#define floor SDL_uclibc_floor
#define __ieee754_log SDL_uclibc_log
#define __ieee754_pow SDL_uclibc_pow
#define round SDL_uclibc_round
#define scalbn SDL_uclibc_scalbn
#define sin SDL_uclibc_sin
#define __ieee754_sqrt SDL_uclibc_sqrt

View file

@ -169,6 +169,16 @@ SDL_pow(double x, double y)
#endif /* HAVE_POW */
}
double
SDL_round(double x)
{
#if defined(HAVE_ROUND)
return round(x);
#else
return SDL_uclibc_round(x);
#endif /* HAVE_ROUND */
}
double
SDL_scalbn(double x, int n)
{