turbojpeg.h: Parenthesize TJSCALED() dimension arg

This ensures that, for example,
TJSCALED(dim0 + dim1, sf)

will evaluate to
(((dim0 + dim1) * sf.num + sf.denom - 1) / sf.denom)

rather than
((dim0 + (dim1 * sf.num) + sf.denom - 1) / sf.denom)
This commit is contained in:
Dmitry Tsarevich
2022-01-06 02:21:10 +03:00
committed by DRC
parent a01857cff6
commit a7f0244e9b

View File

@@ -673,7 +673,7 @@ typedef void *tjhandle;
* scalingFactor)</tt>.
*/
#define TJSCALED(dimension, scalingFactor) \
((dimension * scalingFactor.num + scalingFactor.denom - 1) / \
(((dimension) * scalingFactor.num + scalingFactor.denom - 1) / \
scalingFactor.denom)