P
pdjwind
Unregistered / Unconfirmed
GUEST, unregistred user!
'short bit7_bit8(unsigned char *buf1,unsigned char *buf2,int buf1len)
'{
' if(buf1len<=0) return 0;
' unsigned short Num=0;
' short BitNum=0;
//0-6
' for(int i=0,j=0;i<buf1len;i++){
' buf2[j++]=((buf1<<BitNum)+Num)&0x7f;
' Num=(buf1>>(8-BitNum-1));//得到高位
' if(BitNum==6){buf2[j++]=(unsigned char)Num;Num=BitNum=0;}
' else
BitNum++;
' }
' if(BitNum!=0) buf2[j++]=(unsigned char)Num;
' return j;
'}
'{
' if(buf1len<=0) return 0;
' unsigned short Num=0;
' short BitNum=0;
//0-6
' for(int i=0,j=0;i<buf1len;i++){
' buf2[j++]=((buf1<<BitNum)+Num)&0x7f;
' Num=(buf1>>(8-BitNum-1));//得到高位
' if(BitNum==6){buf2[j++]=(unsigned char)Num;Num=BitNum=0;}
' else
BitNum++;
' }
' if(BitNum!=0) buf2[j++]=(unsigned char)Num;
' return j;
'}