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 129 of file BitVector.cpp.
References singleBitMask.
Referenced by BitVector::getBits(), BitVector::putBits(), TranscodeMP3ADU(), and unpackBandwidthEfficientData().
00131 { 00132 /* Note that from and to may overlap, if from>to */ 00133 unsigned char const* fromBytePtr = fromBasePtr + fromBitOffset/8; 00134 unsigned fromBitRem = fromBitOffset%8; 00135 unsigned char* toBytePtr = toBasePtr + toBitOffset/8; 00136 unsigned toBitRem = toBitOffset%8; 00137 00138 while (numBits-- > 0) { 00139 unsigned char fromBitMask = singleBitMask[fromBitRem]; 00140 unsigned char fromBit = (*fromBytePtr)&fromBitMask; 00141 unsigned char toBitMask = singleBitMask[toBitRem]; 00142 00143 if (fromBit != 0) { 00144 *toBytePtr |= toBitMask; 00145 } else { 00146 *toBytePtr &=~ toBitMask; 00147 } 00148 00149 if (++fromBitRem == 8) { 00150 ++fromBytePtr; 00151 fromBitRem = 0; 00152 } 00153 if (++toBitRem == 8) { 00154 ++toBytePtr; 00155 toBitRem = 0; 00156 } 00157 } 00158 }
1.5.2