主业炒河粉,副业修电脑

Ryan_

Every thing that kills me makes me feel alive.

将二进制下的整数的前十六位与后十六位交换

#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    unsigned long long x;
    cin>>x;
    cout<<((x&0x0000ffff)<<16|(x&0xffff0000)>>16)<<endl;
}

将左/右移的数取并集,不足16位则自动溢出

posted @ 2019-10-17 15:16  Ryan_zero  阅读(296)  评论(0)    收藏  举报