This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| class | BitVector |
Functions | |
| void | shiftBits (unsigned char *toBasePtr, unsigned toBitOffset, unsigned char const *fromBasePtr, unsigned fromBitOffset, unsigned numBits) |
| void shiftBits | ( | unsigned char * | toBasePtr, | |
| unsigned | toBitOffset, | |||
| unsigned char const * | fromBasePtr, | |||
| unsigned | fromBitOffset, | |||
| unsigned | numBits | |||
| ) |
Definition at line 143 of file BitVector.cpp.
References singleBitMask.
Referenced by BitVector::getBits(), BitVector::putBits(), TranscodeMP3ADU(), and unpackBandwidthEfficientData().
00145 { 00146 if (numBits == 0) return; 00147 00148 /* Note that from and to may overlap, if from>to */ 00149 unsigned char const* fromBytePtr = fromBasePtr + fromBitOffset/8; 00150 unsigned fromBitRem = fromBitOffset%8; 00151 unsigned char* toBytePtr = toBasePtr + toBitOffset/8; 00152 unsigned toBitRem = toBitOffset%8; 00153 00154 while (numBits-- > 0) { 00155 unsigned char fromBitMask = singleBitMask[fromBitRem]; 00156 unsigned char fromBit = (*fromBytePtr)&fromBitMask; 00157 unsigned char toBitMask = singleBitMask[toBitRem]; 00158 00159 if (fromBit != 0) { 00160 *toBytePtr |= toBitMask; 00161 } else { 00162 *toBytePtr &=~ toBitMask; 00163 } 00164 00165 if (++fromBitRem == 8) { 00166 ++fromBytePtr; 00167 fromBitRem = 0; 00168 } 00169 if (++toBitRem == 8) { 00170 ++toBytePtr; 00171 toBitRem = 0; 00172 } 00173 } 00174 }
1.5.2