diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h index 73d08a28..38edf3f5 100644 --- a/src/lib/openjp2/opj_intmath.h +++ b/src/lib/openjp2/opj_intmath.h @@ -119,7 +119,7 @@ Divide an integer by a power of 2 and round upwards @return Returns a divided by 2^b */ static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) { - return (a + (1 << b) - 1) >> b; + return (OPJ_INT32)((a + (OPJ_INT64)(1 << b) - 1) >> b); } /** Divide an integer by a power of 2 and round downwards