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

Cameron Gutman aicommander at gmail.com
Thu Nov 6 13:20:08 PST 2014


_WIN32, WIN32, WIN64, and _WIN64 are the wrong definitions to be gating
this on in the first place. They aren't at all meant to be x86/x86-64
specific. At best, they're 32-bit/64-bit specific, but that's not the
intended use in the code. The correct definitions are _M_IX86 and _M_X64,
as Martin said.

I sent a patch to this ML that fixed these a few months ago but it was
forgotten/ignored. Hopefully the issue gets addressed this time.

Cameron
On Nov 6, 2014 9:53 AM, "Martin Storsjö" <martin at martin.st> wrote:

> 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
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/opus/attachments/20141106/7a464222/attachment.htm 


More information about the opus mailing list