内在__mm_loadu_si128返回的负值

时间:2017-02-25 23:59:07

标签: x86 sse intrinsics

到目前为止,这是我的代码:

void main()
{
    unsigned char *test = (unsigned char*)malloc(sizeof(unsigned char)* 16);        
    test[0] = 100;
    test[1] = 128;
    test[2] = 255;
    test[3] = 156;
    test[4] = 190;
    test[5] = 200;
    test[6] = 230;
    test[7] = 250;
    test[8] = 200;
    test[9] = 100;
    test[10] = 100;
    test[11] = 127;
    test[12] = 150;
    test[13] = 170;
    test[14] = 190;
    test[15] = 200;

    //__m256i sa = _mm256_setzero_si256();
    __m128i sa2 = _mm_setzero_si128();
    sa2 = _mm_loadu_si128((__m128i*)&test[0]);

    for (int i = 0; i < 16; i++)
    {
        printf("%d\n", sa2.m128i_i8[i]);
    }
}

我正在尝试测试一些SSE内在函数 我使用__mm_loadu_si128();加载类型为unsigned char的数组 预期的结果是

  

{100,128,....,190,200}

但是,我得到了结果

  

{100,-128,-1,-100,-66,-56,-26,-6,-56,...,-86,-66,-56}

最终结果值的二进制值与我预期结果的值相同 我想知道为什么_mm_loadu_si128加载负值 请帮帮我!

0 个答案:

没有答案