- C/C++ code
//设置位bool CBitManager::SetBit(unsigned int nBitID, bool bBit){ if (!m_pBitBuf || nBitID > m_nMaxBitID) return false;// Debug.Trace(0, "EnableId %d = %d \r\n", nBitID, bBit); if (bBit) m_pBitBuf[nBitID/BIT_OF_DATA_TYPE] |= 0x01<<(nBitID % BIT_OF_DATA_TYPE); else m_pBitBuf[nBitID/BIT_OF_DATA_TYPE] &= ~(0x01<<(nBitID % BIT_OF_DATA_TYPE)); return true;}
------解决方案--------------------------------------------------------
了解指针,数组,位移,类型大小,足矣了吧!代码写的不错。支持!
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
学习学习再学习 努力努力再努力