C++内置函数求汉明距离
#include<iostream>
using namespace std;
#define __builtin_popcount __popcnt
int main() {
int x = 4, y = 10;
cout << __builtin_popcount(x ^ y) << endl;
return 0;
}
#include<iostream>
using namespace std;
#define __builtin_popcount __popcnt
int main() {
int x = 4, y = 10;
cout << __builtin_popcount(x ^ y) << endl;
return 0;
}