summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2022-04-02 15:18:07 -0400
committerJean-Marc Valin <jmvalin@amazon.com>2022-04-02 15:18:07 -0400
commit6ba284f22feeedb394697d112cf1da80c77bb5a4 (patch)
tree8135304088aa151a907c4ba07f946688ff4ba51c
parent2654707e86cc94413998976d179b2ab4a2aa3114 (diff)
downloadopus-6ba284f22feeedb394697d112cf1da80c77bb5a4.tar.gz
Fix lrint/lrintf detection
Prevents using lrint/lrintf when compiling with -std=c90 even though the functions are in libm. This was causing tests to fail, likely due to incorrect prototypes.
-rw-r--r--celt/float_cast.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/celt/float_cast.h b/celt/float_cast.h
index 9d34976e..8915a5fd 100644
--- a/celt/float_cast.h
+++ b/celt/float_cast.h
@@ -99,7 +99,7 @@ static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_s
return intgr ;
}
-#elif defined(HAVE_LRINTF)
+#elif defined(HAVE_LRINTF) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* These defines enable functionality introduced with the 1999 ISO C
** standard. They must be defined before the inclusion of math.h to
@@ -117,7 +117,7 @@ static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_s
#include <math.h>
#define float2int(x) lrintf(x)
-#elif (defined(HAVE_LRINT))
+#elif defined(HAVE_LRINT) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1