shithub: opus

Download patch

ref: e0ae980165e390943cf5d02a67da77d46a5a843c
parent: bb918ef71146b047a843eed5889ad7daa394adb5
author: John Ridges <[email protected]>
date: Sat Oct 16 14:00:54 EDT 2010

Optimised float->int cast for Win64

I've been compiling CELT for 64-bit Windows and it all seems to work
fine (with the occasional benign warning message) except for one place,
and that is in "float_cast.h" where there is some inline assembly
language that gets complied for Windows. Since the Microsoft 64-bit
compiler won't allow inline assembly language (and *still* doesn't have
"lrintf").

--- a/libcelt/float_cast.h
+++ b/libcelt/float_cast.h
@@ -72,6 +72,13 @@
 #include	<math.h>
 #define float2int(x) lrint(x)
 
+#elif (defined (WIN64) || defined (_WIN64))
+	#include <xmmintrin.h>
+
+	__inline long int float2int(float value)
+	{
+		return _mm_cvtss_si32(_mm_load_ss(&value));
+	}
 #elif (defined (WIN32) || defined (_WIN32))
 
 	#include	<math.h>