求 40bit数据分割为10bit数据方法!60分!!
本帖最后由 longneicool 于 2013-10-25 10:40:35 编辑
1001000010 100100000 0100000001 0100000000
如上,40位数据要分割为4个10位数据,求方法。谢谢!
[解决办法]
共同体问题吧
[解决办法]
long long x=....;
n1=x1 & 1024;
x=x>>10;
n2=x1 & 1024
....
[解决办法]
给你一个把10位分成两个5位的,你比个葫芦画个瓢吧
#include "stdafx.h"
#include<iostream>
#include <stdio.h>
#include <bitset>
using namespace std;
int main()
{
bitset<10> b=0x2ab;
for(int i=0;i<2;i++)
{
bitset<5> temp;
for(int j=0;j<5;j++)
{
temp[j]=b[5*i+j];
}
cout<<temp.to_ulong()<<endl;
}
return 0;
}