| Summary: | provide ldexp() as an alternative to scalbn() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ozkan Sezer <sezeroz> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
This patch is now https://hg.libsdl.org/SDL/rev/bd5b569b2a1b, thanks! --ryan. |
The following patch makes SDL_scalbn() to return ldexp(), which is C89, if scalbn() is not present and FLT_RADIX == 2. ---- SDL_scalbn: return ldexp() if scalbn is not present and FLT_RADIX == 2 diff -r 23000b73ce4e src/stdlib/SDL_stdlib.c --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -181,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 */