分类: C/C++
2008-11-25 13:31:02
#typedef unsinged char u
int charToInt(uchar u)
{
uchar mask = 0x01;
//std::cout< int i=2,version=0;
for(int j=1; j<=8;++j)
{
if(j>2)
i<<=1;
if((u&mask)==mask)
{
j==1? version+= 1 :version += i;
}
mask<<=1;
}
return version;
}