Lines Matching full:numbits
121 void Emit(uint32_t Val, unsigned NumBits) {
122 assert(NumBits && NumBits <= 32 && "Invalid value size!");
123 assert((Val & ~(~0U >> (32-NumBits))) == 0 && "High bits set!");
125 if (CurBit + NumBits < 32) {
126 CurBit += NumBits;
137 CurBit = (CurBit+NumBits) & 31;
140 void Emit64(uint64_t Val, unsigned NumBits) {
141 if (NumBits <= 32)
142 Emit((uint32_t)Val, NumBits);
145 Emit((uint32_t)(Val >> 32), NumBits-32);
157 void EmitVBR(uint32_t Val, unsigned NumBits) {
158 assert(NumBits <= 32 && "Too many bits to emit!");
159 uint32_t Threshold = 1U << (NumBits-1);
161 // Emit the bits with VBR encoding, NumBits-1 bits at a time.
163 Emit((Val & ((1 << (NumBits-1))-1)) | (1 << (NumBits-1)), NumBits);
164 Val >>= NumBits-1;
167 Emit(Val, NumBits);
170 void EmitVBR64(uint64_t Val, unsigned NumBits) {
171 assert(NumBits <= 32 && "Too many bits to emit!");
173 return EmitVBR((uint32_t)Val, NumBits);
175 uint32_t Threshold = 1U << (NumBits-1);
177 // Emit the bits with VBR encoding, NumBits-1 bits at a time.
179 Emit(((uint32_t)Val & ((1 << (NumBits-1))-1)) |
180 (1 << (NumBits-1)), NumBits);
181 Val >>= NumBits-1;
184 Emit((uint32_t)Val, NumBits);