Avoid left-shift by 32 on int32 in ectest.

This commit is contained in:
Gregory Maxwell 2011-09-02 19:29:06 -04:00
parent 8a670b19e1
commit 16901bfbbd
3 changed files with 4 additions and 3 deletions

View file

@ -195,6 +195,7 @@ void ec_enc_bits(ec_enc *_this,opus_uint32 _fl,unsigned _bits){
int used;
window=_this->end_window;
used=_this->nend_bits;
celt_assert(_bits>0);
if(used+_bits>EC_WINDOW_SIZE){
do{
_this->error|=ec_write_byte_at_end(_this,(unsigned)window&EC_SYM_MAX);

View file

@ -73,7 +73,7 @@ void ec_enc_uint(ec_enc *_this,opus_uint32 _fl,opus_uint32 _ft);
/*Encodes a sequence of raw bits in the stream.
_fl: The bits to encode.
_ftb: The number of bits to encode.
This must be between 0 and 25, inclusive.*/
This must be between 1 and 25, inclusive.*/
void ec_enc_bits(ec_enc *_this,opus_uint32 _fl,unsigned _ftb);
/*Overwrites a few bits at the very start of an existing stream, after they

View file

@ -55,7 +55,7 @@ int main(int _argc,char **_argv){
}
}
/*Testing encoding of raw bit values.*/
for(ftb=0;ftb<16;ftb++){
for(ftb=1;ftb<16;ftb++){
for(i=0;i<(1<<ftb);i++){
entropy+=ftb;
nbits=ec_tell(&enc);
@ -84,7 +84,7 @@ int main(int _argc,char **_argv){
}
}
}
for(ftb=0;ftb<16;ftb++){
for(ftb=1;ftb<16;ftb++){
for(i=0;i<(1<<ftb);i++){
sym=ec_dec_bits(&dec,ftb);
if(sym!=(unsigned)i){