[opus] [PATCH] float_cast: Fix MSVC ARM build

Martin Storsjö martin at martin.st
Thu Nov 6 09:16:19 PST 2014


On Thu, 6 Nov 2014, Hugo Beauzée-Luyssen wrote:

> ---
> celt/float_cast.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/celt/float_cast.h b/celt/float_cast.h
> index ede6574..4892e2c 100644
> --- a/celt/float_cast.h
> +++ b/celt/float_cast.h
> @@ -90,14 +90,14 @@
> #include <math.h>
> #define float2int(x) lrint(x)
>
> -#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64))
> +#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64)) && !defined(_M_ARM)
>         #include <xmmintrin.h>
>
>         __inline long int float2int(float value)
>         {
>                 return _mm_cvtss_si32(_mm_load_ss(&value));
>         }
> -#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32))
> +#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32)) && !defined(_M_ARM)
>         #include <math.h>
>
>         /*      Win32 doesn't seem to have these functions.
> -- 
> 2.1.1

As MSVC might support other architectures than arm and x86 (they did 
support mips, alpha and itanium at some points in time), I think it might 
be better to use this instead:

... && (defined(_M_IX86) || defined(_M_X64))

// Martin


More information about the opus mailing list