$$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Self-defined math definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Math symbol commands \newcommand{\intd}{\,{\rm d}} % Symbol 'd' used in integration, such as 'dx' \newcommand{\diff}{{\rm d}} % Symbol 'd' used in differentiation ... $$

循环左移的C++实现。

#include<iostream>
#include <bitset>
using namespace std;

int main(void){
    unsigned int n = 2;
    unsigned int val = 655357999;
    cout << bitset<32>(val) << endl;
    //cout << sizeof(unsigned int) << endl;
    unsigned z = (val >> (sizeof(unsigned int)*8 - n) | (val << n));
    cout  << bitset<32>(z) << endl;
    
    return 0;

}

 

posted @ 2023-05-30 15:57  素衣叹风尘  阅读(32)  评论(0)    收藏  举报