Bit of cleaning up in the byte dumping part. Making use of any remaining bit(s)
[opus.git] / libcelt / bitrdec.c
1 #include "bitree.h"
2
3 int ec_bitree_find_and_update(unsigned *_this,int _sz,int _split,
4  unsigned _freq,unsigned *_fl,int _val){
5   int base;
6   int test;
7   int fl;
8   base=-1;
9   fl=0;
10   while(_split>0){
11     test=base+_split;
12     if(test<_sz){
13       if(_freq>=_this[test]){
14         _freq-=_this[test];
15         fl+=_this[test];
16         base=test;
17       }
18       else _this[test]+=_val;
19     }
20     _split>>=1;
21   }
22   *_fl=fl;
23   return base+1;
24 }