标签:unsigned sig return one 要求 sign signed ret nes
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;
}
?
odd_ones,我用了15个操作,要求12个操作,我尽力了。请大侠指教!
标签:unsigned sig return one 要求 sign signed ret nes
原文地址:https://www.cnblogs.com/HKROnline-SyncNavigator/p/11055060.html