int odd_ones(unsigned int v)
{
? ? unsigned int v1=v>>16;
? ? unsigned int v2=v&0xffff;
? ? unsigned int v3=v2 ^ v1; // 16
? ? unsigned int v4=v3>>8;
? ? unsigned int v5=v3&0xff;
? ? unsigned int v6=v4 ^ v5; //8?
? ? unsigned int v7=v6>>4;
? ? unsigned int v8=v6&0xf;
? ? unsigned int v9=v7 ^ v8; //4?
? ? unsigned int v10=v9>>2;
? ? unsigned int v11=v9&0x3;
? ? unsigned int v12=v11 ^ v10; //2?
? ? unsigned int v13=v12>>1;
? ? unsigned int v14=v12 & 0x1;
? ? unsigned int v15=v13 ^ v14; //2?
? ? return v15;
}
?
原文地址:https://www.cnblogs.com/HKROnline-SyncNavigator/p/11055060.html
时间: 2024-10-12 17:40:22