vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Nov 13 13:27:40 2016 +0200| [387c812abebb7c1bf81e135f283ce3b5b640bd4b] | committer: Rémi Denis-Courmont
compat: add sincos() and sincosf() replacements > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=387c812abebb7c1bf81e135f283ce3b5b640bd4b --- compat/sincos.c | 37 +++++++++++++++++++++++++++++++++++++ configure.ac | 2 +- include/vlc_fixups.h | 5 +++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/compat/sincos.c b/compat/sincos.c new file mode 100644 index 0000000..60397fb --- /dev/null +++ b/compat/sincos.c @@ -0,0 +1,37 @@ +/***************************************************************************** + * sincos.c: GNU sincos() & sincosf() replacements + ***************************************************************************** + * Copyright © 2016 Rémi Denis-Courmont + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <math.h> + +void sincos(double r, double *restrict sr, double *restrict cr) +{ + *sin = sin(r); + *cos = con(r); +} + +void sincosf(float r, float *restrict sr, float *restrict cr) +{ + *sin = sinf(r); + *cos = conf(r); +} diff --git a/configure.ac b/configure.ac index c8900d2..88ecada 100644 --- a/configure.ac +++ b/configure.ac @@ -598,7 +598,7 @@ need_libc=false dnl Check for usual libc functions AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime tdestroy uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock]) -AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp]) +AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv sincos strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp]) AC_REPLACE_FUNCS([gettimeofday]) AC_CHECK_FUNC(fdatasync,, [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h index 7b7e619..a3fc6f3 100644 --- a/include/vlc_fixups.h +++ b/include/vlc_fixups.h @@ -481,6 +481,11 @@ void freeaddrinfo (struct addrinfo *res); #define nanf(tagp) NAN #endif +#ifndef HAVE_SINCOS +void sincos(double, double *, double *); +void sincosf(float, float *, float *); +#endif + #ifndef HAVE_REALPATH char *realpath(const char * restrict pathname, char * restrict resolved_path); #endif _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
