shithub: libsamplerate

Download patch

ref: b3180311dec5ee46a33a1accd6802a24cf2564a1
parent: f59ea54307f17b0a9b7706409170cec4712ce530
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Thu May 24 19:43:42 EDT 2007

src/common.h : Optimize fmod_one.

--- a/src/common.h
+++ b/src/common.h
@@ -135,14 +135,13 @@
 
 static inline double
 fmod_one (double x)
-{	double y = 1.0 ;
-	double i, f ;
+{	double res ;
 
-	i = floor (x / y) ;
-	f = x - i * y ;
-	if ((x < 0.0) != (y < 0.0))
-		f = f - y ;
-	return f ;
+	res = x - lrint (x) ;
+	if (res < 0.0)
+		return res + 1.0 ;
+
+	return res ;
 } /* fmod_one */
 
 #endif	/* COMMON_H_INCLUDED */