我想知道,在Visual Studio 2010中设置什么才能启用SSE 4.2?我想使用它因为优化的POPCNT ...
如果所有设置都正常,我该如何测试?
谢谢
好吧,我试图使用你的解决方案,但<nmmintric.h>不包括在vstudio2010和标准__popcnt要求int而不是std::bitset<>:(
任何的想法?
Thx用于正确标题的提示.然而,似乎:error C3861: '_mm_popcnt_u64': identifier not found我发现只有_mm_popcnt_u32,但我不知道,如何使用它bitset,或者我应该使用它bitset<>.count?没有编译器的anz设置就无法工作,可以吗?
没人知道 ?
小智 7
你必须在你的代码中写_mm_popcnt_u64.另外最好检查一下你运行的cpu是否支持该指令.并为x64构建.
#include <stdio.h>
#include <nmmintrin.h>
int main ()
{
unsigned __int64 a = 0x123456789ABCDEF0;
int res = _mm_popcnt_u64(a);
printf_s("Result res should be 32: %d\n", res);
return 0;
}
Run Code Online (Sandbox Code Playgroud)