From 75d27803d52f44f4618c4796111c179e24ba558e Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Tue, 30 Aug 2011 14:02:41 -0400 Subject: [PATCH] Adds many syntactically unnecessary parentheses to silence MSVC C4554. The object code is unchanged. --- libcelt/bands.c | 8 ++++---- libcelt/celt.c | 14 +++++++------- libcelt/cwrs.c | 12 ++++++------ libcelt/entcode.c | 2 +- libcelt/entdec.c | 4 ++-- libcelt/entenc.c | 12 ++++++------ libcelt/mathops.c | 4 ++-- libcelt/mfrngcod.h | 2 +- libcelt/rate.c | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/libcelt/bands.c b/libcelt/bands.c index d057c261..75c32247 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -68,7 +68,7 @@ static int bitexact_log2tan(int isin,int icos) ls=EC_ILOG(isin); icos<<=15-lc; isin<<=15-ls; - return (ls-lc<<11) + return ((ls-lc)<<11) +FRAC_MUL16(isin, FRAC_MUL16(isin, -2597) + 7932) -FRAC_MUL16(icos, FRAC_MUL16(icos, -2597) + 7932); } @@ -222,7 +222,7 @@ void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_mas N0 = m->eBands[i+1]-m->eBands[i]; /* depth in 1/8 bits */ - depth = (1+pulses[i])/(m->eBands[i+1]-m->eBands[i]<eBands[i+1]-m->eBands[i])<vbr_reservoir>>(BITRES+3)), + (vbr_rate+vbr_bound-st->vbr_reservoir)>>(BITRES+3)), nbAvailableBytes); if(max_allowed < nbAvailableBytes) { @@ -1404,9 +1404,9 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f result in the encoder running out of bits. The margin of 2 bytes ensures that none of the bust-prevention logic in the decoder will have triggered so far. */ - min_allowed = (tell+total_boost+(1<>(BITRES+3)) + 2 - nbFilledBytes; + min_allowed = ((tell+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3)) + 2 - nbFilledBytes; - nbAvailableBytes = target+(1<<(BITRES+2))>>(BITRES+3); + nbAvailableBytes = (target+(1<<(BITRES+2)))>>(BITRES+3); nbAvailableBytes = IMAX(min_allowed,nbAvailableBytes); nbAvailableBytes = IMIN(nbCompressedBytes,nbAvailableBytes+nbFilledBytes) - nbFilledBytes; @@ -1492,8 +1492,8 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f ALLOC(fine_priority, st->mode->nbEBands, int); /* bits = packet size - where we are - safety*/ - bits = ((opus_int32)nbCompressedBytes*8<=2&&bits>=(LM+2<=2&&bits>=((LM+2)<mode, st->start, st->end, offsets, cap, alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses, @@ -2480,8 +2480,8 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in alloc_trim = tell+(6<=2&&bits>=(LM+2<=2&&bits>=((LM+2)<mode, st->start, st->end, offsets, cap, alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses, diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c index 38051655..e5cd08d7 100644 --- a/libcelt/cwrs.c +++ b/libcelt/cwrs.c @@ -118,12 +118,12 @@ static inline opus_uint32 imusdiv32even(opus_uint32 _a,opus_uint32 _b, celt_assert(_d>0); celt_assert(_d<=54); shift=EC_ILOG(_d^_d-1); - inv=INV_TABLE[_d-1>>shift]; + inv=INV_TABLE[(_d-1)>>shift]; shift--; one=1<>shift)-(_c>>shift)+ - (_a*(_b&mask)+one-(_c&mask)>>shift)-1)*inv&MASK32; + ((_a*(_b&mask)+one-(_c&mask))>>shift)-1)*inv&MASK32; } #endif /* SMALL_FOOTPRINT */ @@ -356,7 +356,7 @@ static opus_uint32 ncwrs_urow(unsigned _n,unsigned _k,opus_uint32 *_u){ /*U(N,K) = ((2*N-1)*U(N,K-1)-U(N,K-2))/(K-1) + U(N,K-2)*/ _u[k]=um2=imusdiv32even(n2m1,um1,um2,k-1)+um2; if(++k>=len)break; - _u[k]=um1=imusdiv32odd(n2m1,um2,um1,k-1>>1)+um1; + _u[k]=um1=imusdiv32odd(n2m1,um2,um1,(k-1)>>1)+um1; } } #endif /* SMALL_FOOTPRINT */ @@ -385,7 +385,7 @@ static inline void cwrsi2(int _k,opus_uint32 _i,int *_y){ s=-(_i>=p); _i-=p&s; yj=_k; - _k=_i+1>>1; + _k=(_i+1)>>1; p=_k?ucwrs2(_k):0; _i-=p; yj-=_k; @@ -406,7 +406,7 @@ static void cwrsi3(int _k,opus_uint32 _i,int *_y){ yj=_k; /*Finds the maximum _k such that ucwrs3(_k)<=_i (tested for all _i<2147418113=U(3,32768)).*/ - _k=_i>0?isqrt32(2*_i-1)+1>>1:0; + _k=_i>0?(isqrt32(2*_i-1)+1)>>1:0; p=_k?ucwrs3(_k):0; _i-=p; yj-=_k; @@ -433,7 +433,7 @@ static void cwrsi4(int _k,opus_uint32 _i,int *_y){ kl=0; kr=_k; for(;;){ - _k=kl+kr>>1; + _k=(kl+kr)>>1; p=_k?ucwrs4(_k):0; if(p<_i){ if(_k>=kr)break; diff --git a/libcelt/entcode.c b/libcelt/entcode.c index 984987ee..0d9c7fc5 100644 --- a/libcelt/entcode.c +++ b/libcelt/entcode.c @@ -76,7 +76,7 @@ opus_uint32 ec_tell_frac(ec_ctx *_this){ encoder or decoder claims to have used 1 bit.*/ nbits=_this->nbits_total<rng); - r=_this->rng>>l-16; + r=_this->rng>>(l-16); for(i=BITRES;i-->0;){ int b; r=r*r>>15; diff --git a/libcelt/entdec.c b/libcelt/entdec.c index 47d710bd..00aac6ca 100644 --- a/libcelt/entdec.c +++ b/libcelt/entdec.c @@ -114,7 +114,7 @@ static void ec_dec_normalize(ec_dec *_this){ /*Read the next value from the input.*/ _this->rem=ec_read_byte(_this); /*Take the rest of the bits we need from this new symbol.*/ - sym=(sym<rem)>>EC_SYM_BITS-EC_CODE_EXTRA; + sym=(sym<rem)>>(EC_SYM_BITS-EC_CODE_EXTRA); /*And subtract them from val, capped to be less than EC_CODE_TOP.*/ _this->val=(_this->val<offs=0; _this->rng=1U<rem=ec_read_byte(_this); - _this->val=_this->rng-1-(_this->rem>>EC_SYM_BITS-EC_CODE_EXTRA); + _this->val=_this->rng-1-(_this->rem>>(EC_SYM_BITS-EC_CODE_EXTRA)); _this->error=0; /*Normalize the interval.*/ ec_dec_normalize(_this); diff --git a/libcelt/entenc.c b/libcelt/entenc.c index 68aee104..6a4de9ed 100644 --- a/libcelt/entenc.c +++ b/libcelt/entenc.c @@ -103,7 +103,7 @@ static void ec_enc_normalize(ec_enc *_this){ while(_this->rng<=EC_CODE_BOT){ ec_enc_carry_out(_this,(int)(_this->val>>EC_CODE_SHIFT)); /*Move the next-to-high-order symbol into the high-order position.*/ - _this->val=_this->val<val=(_this->val<rng<<=EC_SYM_BITS; _this->nbits_total+=EC_SYM_BITS; } @@ -215,7 +215,7 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits){ unsigned mask; celt_assert(_nbits<=EC_SYM_BITS); shift=EC_SYM_BITS-_nbits; - mask=(1<<_nbits)-1<offs>0){ /*The first byte has been finalized.*/ _this->buf[0]=(unsigned char)(_this->buf[0]&~mask|_val<rem=_this->rem&~mask|_val<rng<=EC_CODE_TOP>>shift){ + else if(_this->rng<=(EC_CODE_TOP>>shift)){ /*The renormalization loop has never been run.*/ _this->val=_this->val&~((opus_uint32)mask<error=-1; @@ -249,7 +249,7 @@ void ec_enc_done(ec_enc *_this){ /*We output the minimum number of bits that ensures that the symbols encoded thus far will be decoded correctly regardless of the bits that follow.*/ l=EC_CODE_BITS-EC_ILOG(_this->rng); - msk=EC_CODE_TOP-1>>l; + msk=(EC_CODE_TOP-1)>>l; end=_this->val+msk&~msk; if((end|msk)>=_this->val+_this->rng){ l++; @@ -258,7 +258,7 @@ void ec_enc_done(ec_enc *_this){ } while(l>0){ ec_enc_carry_out(_this,(int)(end>>EC_CODE_SHIFT)); - end=end<>1; + bshift=(EC_ILOG(_val)-1)>>1; b=1U<>EC_SYM_BITS) /*The number of bits available for the last, partial symbol in the code field.*/ diff --git a/libcelt/rate.c b/libcelt/rate.c index 9ac85740..145b1d46 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -497,7 +497,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int { int extra_fine; int extra_bits; - extra_fine = IMIN(excess >> stereo+BITRES, MAX_FINE_BITS-ebits[j]); + extra_fine = IMIN(excess>>(stereo+BITRES),MAX_FINE_BITS-ebits[j]); ebits[j] += extra_fine; extra_bits = extra_fine*C<= excess-balance;