97 size_t ByteStart = 0, ByteEnd = 8;
100 Byte &= (1u << (8 -
StartBit)) - 1u;
103 size_t CurrentNumBits = ByteEnd - ByteStart;
104 if (CurrentNumBits > NumBits) {
105 Byte >>= CurrentNumBits - NumBits;
106 CurrentNumBits = NumBits;
108 Index <<= CurrentNumBits;
109 Index |= Byte & ((1u << CurrentNumBits) - 1u);
111 assert(NumBits >= CurrentNumBits);
112 NumBits -= CurrentNumBits;