bits->chars[bits->charPtr] |= bit<<(7-bits->bitPtr);
bits->chars[bits->charPtr] |= bit<<(BITS_PER_CHAR-1-bits->bitPtr);
void speex_bits_pack(SpeexBits *bits, int data, int nbBits){   unsigned int d=data;   if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)   {      speex_warning("Buffer too small to pack bits");      if (bits->owner)      {	int new_nchars = ((bits->buf_size+5)*3)>>1;         char *tmp = (char*)speex_realloc(bits->chars, new_nchars);         if (tmp)         {	    speex_memset_bytes(tmp, 0, new_nchars);            bits->buf_size=new_nchars;            bits->chars=tmp;         } else {            speex_warning("Could not resize input buffer: not packing");            return;         }      } else {         speex_warning("Do not own input buffer: not packing");         return;      }   }   while(nbBits)   {      int bit;      bit = (d>>(nbBits-1))&1;      bits->chars[bits->charPtr] |= bit<<(7-bits->bitPtr);      bits->bitPtr++;      if (bits->bitPtr==8)      {         bits->bitPtr=0;         bits->charPtr++;         bits->chars[bits->charPtr] = 0;      }      bits->nbBits++;      nbBits--;   }}