From a32e087d07257bb5754ebde4a92d5cb6fc4e3fdf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 29 Aug 2017 00:36:17 -0400 Subject: [PATCH] stdlib: An implementation of SDL_scalbn using ldexp() (thanks, Ozkan!). Fixes Bugzilla #3767. --HG-- extra : rebase_source : c8dfcbc036ca99ce20808a33204cd87ae9b3e4d2 --- src/stdlib/SDL_stdlib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index 194298d3c..36b554857 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -187,6 +187,10 @@ SDL_scalbn(double x, int n) return scalbn(x, n); #elif defined(HAVE__SCALB) return _scalb(x, n); +#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2) +/* from scalbn(3): If FLT_RADIX equals 2 (which is + * usual), then scalbn() is equivalent to ldexp(3). */ + return ldexp(x, n); #else return SDL_uclibc_scalbn(x, n); #endif /* HAVE_SCALBN */