#include "BitVector.hh"Include dependency graph for BitVector.cpp:

Go to the source code of this file.
Defines | |
| #define | MAX_LENGTH 32 |
Functions | |
| void | shiftBits (unsigned char *toBasePtr, unsigned toBitOffset, unsigned char const *fromBasePtr, unsigned fromBitOffset, unsigned numBits) |
Variables | |
| static unsigned char const | singleBitMask [8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01} |
| #define MAX_LENGTH 32 |
Definition at line 41 of file BitVector.cpp.
Referenced by BitVector::getBits(), and BitVector::putBits().
| 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 }
unsigned char const singleBitMask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01} [static] |
1.5.2