SIMDRegister<int> bug?

I was trying to do something like this:

int t = 100;
auto a = dsp::SIMDRegister<int>::fromNative({ t,0,0,0 });

…but the compiler (VS2017) throws an error:
Error C2397 - conversion from ‘int’ to ‘char’ requires a narrowing conversion

It compiles nicely if it’s not an INT register:

float t = 100.0f;
auto a = dsp::SIMDRegister<float>::fromNative({ t, 0.0f, 0.0f, 0.0f });

I was able to solve it this way:

int t = 100;
const dsp::SIMDRegister<int> a = _mm_set_epi32(0,0,0,t);

…but wondering if it’s a JUCE bug or it’s me not understanding something?

1 Like

If you want to write cross-platform code then you’ll need to use _mm_set_epi32 and friends here.

Different compilers access the data in different ways. MSVC defines __m128i as an array of characters, whereas gcc defines it as long long[2].

1 Like

thanks t0m, it’s interesting…