Commit cc281048 authored by erikd's avatar erikd

Detect availability of C99 inline keyword in configure and use it in...

Detect availability of C99 inline keyword in configure and use it in lib/scales.h. Also add workaround for MSVS which uses __inline.

svn path=/trunk/vorbis/; revision=13629
parent 9505d189
......@@ -46,6 +46,8 @@ AC_PROG_CC
AC_PROG_CPP
CFLAGS="$cflags_save"
AC_C_INLINE
AM_PROG_LIBTOOL
dnl docbook xml transform and processing tools
......@@ -103,10 +105,10 @@ else
AC_MSG_RESULT([$GCC_VERSION])
case $host in
*86-*-linux*)
DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
# PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
# PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
# glibc < 2.1.3 has a serious FP bug in the math inline header
# that will cripple Vorbis. Look to see if the magic FP stack
......@@ -148,24 +150,24 @@ else
PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
fi;;
powerpc-*-linux*)
DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES"
CFLAGS="-O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
*-*-linux*)
DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
sparc-sun-*)
DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -mv8"
CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char -mv8"
CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
*-*-darwin*)
DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
*)
DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char"
CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
esac
fi
......
......@@ -21,11 +21,16 @@
#include <math.h>
#include "os.h"
#ifdef _MSC_VER
/* MS Visual Studio doesn't have C99 inline keyword. */
#define inline __inline
#endif
/* 20log10(x) */
#define VORBIS_IEEE_FLOAT32 1
#ifdef VORBIS_IEEE_FLOAT32
static float unitnorm(float x){
static inline float unitnorm(float x){
union {
ogg_uint32_t i;
float f;
......@@ -36,7 +41,7 @@ static float unitnorm(float x){
}
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
static float todB(const float *x){
static inline float todB(const float *x){
union {
ogg_uint32_t i;
float f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment