none
static __m128i _0x80000000 = {...}; //(Not important)

    Frage

  • 1) Instead of doing:

        static __m128i _0x80000000 = {
            0x80000000,
            0x80000000,
            0x80000000,
            0x80000000,
        };


    2) I can only do:

        static __m128i _0x80000000 = {
            0x00,0x00,0x00,0x80,
            0x00,0x00,0x00,0x80,
            0x00,0x00,0x00,0x80,
            0x00,0x00,0x00,0x80,
        };

    The first 1) looks good, but why I can't do it?

    Samstag, 3. März 2012 08:28

Antworten

  • Neither is good.  See the definition of __m128i in Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\emmintrin.h :

    typedef union __declspec(intrin_type) _CRT_ALIGN(16) __m128i {
        __int8              m128i_i8[16];
        __int16             m128i_i16[8];
        __int32             m128i_i32[4];   
        __int64             m128i_i64[2];
        unsigned __int8     m128i_u8[16];
        unsigned __int16    m128i_u16[8];
        unsigned __int32    m128i_u32[4];
        unsigned __int64    m128i_u64[2];
    } __m128i;

    Your static initialization is setting values into the first member of the union - the __int8[16] field.

    Both initializations issue a warning.  The first sets the first 4 elements of the array. The second sets all 16, but 0x80 is too big to be held in a signed __int8 field.

    Please see: http://support.microsoft.com/kb/47693 for further explanation.


    Jim

    Donnerstag, 24. Mai 2012 04:09