二进制字符串转整数

来源:互联网 发布:c语言判断正负 while 编辑:程序博客网 时间:2024/05/29 04:07
void BinaryStringToInt(LPCTSTR lpszBinary, LONG* a){for (int i = _tcslen(lpszBinary) - 1, BitOffset = 0; i >= 0; i--, BitOffset++){if (lpszBinary[i] == TEXT('1')){__asm{mov eax, BitOffsetmov ebx, a;bts dword ptr [ebx], eax}}else{__asm{mov eax, BitOffsetmov ebx, a;btr dword ptr [ebx], eax}}}}

0 0