📜  滚动二进制 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:36.289000             🧑  作者: Mango

代码示例1
// U can change the type by changing char to int
unsigned char rol(unsigned char value, unsigned char roll)
{
    roll = roll % sizeof(char) * 8;
    unsigned char mask_rolld = ~(0xFF >> roll);
    unsigned char lmb = (mask_rolld & value) >> (sizeof(char) * 8 - roll);
    return (value << roll) | lmb;
}