[CELT-dev] WIN64 issue

John Ridges
2010-10-16T16:17:50Z

Hi Jean-Marc,

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"), I suggest the following change to use intrinsics for the
64-bit compiler:

  --- float_cast.h    Sat Oct 17 19:51:32 2009
+++ new\float_cast.h    Fri Oct 15 12:09:38 2010
@@ -72,8 +72,14 @@
  #include <math.h>
  #define float2int(x) lrint(x)

-#elif (defined (WIN32) || defined (_WIN32))
+#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>

      /*    Win32 doesn't seem to have these functions.


BTW, I have also compiled CELT for 64-bit Mac OS X with no problems.

Cheers,

John Ridges