Lines Matching defs:nbBits
78 bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
96 bits->nbBits=0;
141 bits->nbBits=nchars<<LOG2_BITS_PER_CHAR;
149 int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
152 bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR;
161 if (((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)+nchars > bits->buf_size)
166 char *tmp = (char*)speex_realloc(bits->chars, (bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1);
169 bits->buf_size=(bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1;
172 nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
182 pos=bits->nbBits>>LOG2_BITS_PER_CHAR;
185 bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
192 int charPtr, bitPtr, nbBits;
197 nbBits=bits->nbBits;
201 bits->nbBits=nbBits;
203 if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR))
204 max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
215 if (max_nchars > ((bits->nbBits)>>LOG2_BITS_PER_CHAR))
216 max_nchars = ((bits->nbBits)>>LOG2_BITS_PER_CHAR);
225 bits->nbBits &= (BITS_PER_CHAR-1);
229 EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
233 if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
254 while(nbBits)
257 bit = (d>>(nbBits-1))&1;
267 bits->nbBits++;
268 nbBits--;
272 EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
274 unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
276 if (d>>(nbBits-1))
278 d |= (-1)<<nbBits;
283 EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
286 if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
290 while(nbBits)
300 nbBits--;
305 EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
311 if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
319 while(nbBits)
329 nbBits--;
336 if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
345 if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
358 return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
363 return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);