Avoid relying on operator precedence (raised by cppcheck)

This commit is contained in:
Even Rouault 2017-09-19 18:35:52 +02:00
parent c22ea12219
commit 8df07d5866
1 changed files with 3 additions and 3 deletions

View File

@ -348,7 +348,7 @@ static INLINE void opj_t1_enc_sigpass_step(opj_t1_t *t1,
if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U && if ((flags & ((T1_SIGMA_THIS | T1_PI_THIS) << (ci * 3U))) == 0U &&
(flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) { (flags & (T1_SIGMA_NEIGHBOURS << (ci * 3U))) != 0U) {
OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U)); OPJ_UINT32 ctxt1 = opj_t1_getctxno_zc(mqc, flags >> (ci * 3U));
v = opj_int_abs(*datap) & one ? 1 : 0; v = (opj_int_abs(*datap) & one) ? 1 : 0;
#ifdef DEBUG_ENC_SIG #ifdef DEBUG_ENC_SIG
fprintf(stderr, " ctxt1=%d\n", ctxt1); fprintf(stderr, " ctxt1=%d\n", ctxt1);
#endif #endif
@ -735,7 +735,7 @@ static INLINE void opj_t1_enc_refpass_step(opj_t1_t *t1,
OPJ_UINT32 ctxt = opj_t1_getctxno_mag(shift_flags); OPJ_UINT32 ctxt = opj_t1_getctxno_mag(shift_flags);
*nmsedec += opj_t1_getnmsedec_ref((OPJ_UINT32)opj_int_abs(*datap), *nmsedec += opj_t1_getnmsedec_ref((OPJ_UINT32)opj_int_abs(*datap),
(OPJ_UINT32)bpno); (OPJ_UINT32)bpno);
v = opj_int_abs(*datap) & one ? 1 : 0; v = (opj_int_abs(*datap) & one) ? 1 : 0;
#ifdef DEBUG_ENC_REF #ifdef DEBUG_ENC_REF
fprintf(stderr, " ctxt=%d\n", ctxt); fprintf(stderr, " ctxt=%d\n", ctxt);
#endif #endif
@ -1079,7 +1079,7 @@ static void opj_t1_enc_clnpass_step(
printf(" ctxt1=%d\n", ctxt1); printf(" ctxt1=%d\n", ctxt1);
#endif #endif
opj_mqc_setcurctx(mqc, ctxt1); opj_mqc_setcurctx(mqc, ctxt1);
v = opj_int_abs(*datap) & one ? 1 : 0; v = (opj_int_abs(*datap) & one) ? 1 : 0;
opj_mqc_encode(mqc, v); opj_mqc_encode(mqc, v);
if (v) { if (v) {
OPJ_UINT32 ctxt2, spb; OPJ_UINT32 ctxt2, spb;