shithub: libsamplerate

Download patch

ref: c6ae1e72c02c0a2998684f7eb903a96aee1f5fc3
parent: 10c879266abb00bd9378f37ac8f674411b5083eb
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Sat Feb 28 05:28:49 EST 2004

Update AC_C_CLIP_MODE.

--- a/acinclude.m4
+++ b/acinclude.m4
@@ -265,6 +265,9 @@
             [Define if you have C99's llrint function.])
 fi
 ])# AC_C99_FUNC_LLRINT
+
+
+
 dnl @synopsis AC_C_CLIP_MODE
 dnl
 dnl Determine the clipping mode when converting float to int.
@@ -279,10 +282,6 @@
 
 
 
-
-
-
-
 dnl Find the clipping mode in the following way:
 dnl    1) If we are not cross compiling test it.
 dnl    2) IF we are cross compiling, assume that clipping isn't done correctly.
@@ -295,7 +294,6 @@
 ac_cv_c_clip_positive=unknown
 ac_cv_c_clip_negative=unknown
 
-
 if test $ac_cv_c_clip_positive = unknown ; then
 	AC_TRY_RUN(
 	[[
@@ -305,24 +303,26 @@
 	#define __USE_ISOC9X	1
 	#include <math.h>
 	int main (void)
-	{	double	fval [] = { 1.0 * 0x7FFFFFFF, 1.1 * 0x7FFFFFFF, 1.2 * 0x7FFFFFFF } ;
+	{	double	fval ;
+		int k, ival ;
 
-		if (lrint (fval [0]) < 0)
-			return 0 ;
+		fval = 1.0 * 0x7FFFFFFF ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != 127)
+				return 1 ;
 		
-		if (lrint (fval [1]) < 0)
-			return 0 ;
+			fval *= 1.2499999 ;
+			} ;
 		
-		if (lrint (fval [2]) < 0)
 			return 0 ;
-		
-		return 1 ;
 		}
-		]], , ac_cv_c_clip_positive=yes, 
+		]],
+		ac_cv_c_clip_positive=yes,
+		ac_cv_c_clip_positive=no,
 		ac_cv_c_clip_positive=unknown
 		)
 
-
 	AC_TRY_RUN(
 	[[
 	#define	_ISOC9X_SOURCE	1
@@ -331,20 +331,23 @@
 	#define __USE_ISOC9X	1
 	#include <math.h>
 	int main (void)
-	{	double	fval [] = { -8.0 * 0x10000000, -8.8 * 0x10000000, -9.6 * 0x10000000 } ;
+	{	double	fval ;
+		int k, ival ;
 
-		if (lrint (fval [0]) > 0)
-			return 0 ;
+		fval = -8.0 * 0x10000000 ;
+		for (k = 0 ; k < 100 ; k++)
+		{	ival = (lrint (fval)) >> 24 ;
+			if (ival != -128)
+				return 1 ;
 		
-		if (lrint (fval [1]) > 0)
-			return 0 ;
+			fval *= 1.2499999 ;
+			} ;
 		
-		if (lrint (fval [2]) > 0)
 			return 0 ;
-		
-		return 1 ;
 		}
-		]], , ac_cv_c_clip_negative=yes, 
+		]],
+		ac_cv_c_clip_negative=yes,
+		ac_cv_c_clip_negative=no,
 		ac_cv_c_clip_negative=unknown
 		)