/** The result of rotating X left by 4 bits. To rotate left means
* that the 4 most significant bits become the 4 least significant
* and all other bits move left by 4. For example,
* rotl4(0x12345678) is 0x23456781. */
int rotl4(int x) {
return ;
}
我想弄清楚如何移动4个最重要的位但是我不确定你将如何将它们旋转到最后 -Thanks
答案 0 :(得分:1)
您搜索的内容为Circular shift operations
目前,你可以试试这个:
int rotl4(int x) {
unsigned int y = x;
return ((y>>28)|(y<<4));
}