From 2a6d6c2a7e2e56c5917e50dba288faec31cd1e60 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Fri, 7 Nov 2014 12:23:39 -0800 Subject: [PATCH 1/2] Fix Apple/Clang compilation for fmaf() --- include/interpolation.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/interpolation.h b/include/interpolation.h index 113058e4f..6ec234036 100644 --- a/include/interpolation.h +++ b/include/interpolation.h @@ -81,7 +81,11 @@ inline float cosinusInterpolate( float v0, float v1, float x ) { const float f = ( 1.0f - cosf( x * F_PI ) ) * 0.5f; #ifdef FP_FAST_FMAF - return fmaf( f, v1-v0, v0 ); + #ifndef __clang__ + return fmaf( f, v1-v0, v0 ); + #else + return fma( f, v1-v0, v0 ); + #endif #else return f * (v1-v0) + v0; #endif @@ -94,8 +98,11 @@ inline float linearInterpolate( float v0, float v1, float x ) // take advantage of fma function if present in hardware #ifdef FP_FAST_FMAF - return fmaf( x, v1-v0, v0 ); -#else + #ifndef __clang__ + return fmaf( x, v1-v0, v0 ); + #else + return fma( x, v1-v0, v0 ); + #endif return x * (v1-v0) + v0; #endif } From 4e5d4b95a0562f59f2ada3cd0c846e6f1a7a25ad Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Fri, 7 Nov 2014 12:39:00 -0800 Subject: [PATCH 2/2] Typo, add missing "else" --- include/interpolation.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/interpolation.h b/include/interpolation.h index 6ec234036..5dd98ea3f 100644 --- a/include/interpolation.h +++ b/include/interpolation.h @@ -103,6 +103,7 @@ inline float linearInterpolate( float v0, float v1, float x ) #else return fma( x, v1-v0, v0 ); #endif +#else return x * (v1-v0) + v0; #endif }