1
0
mirror of https://github.com/libjpeg-turbo/libjpeg-turbo.git synced 2026-10-23 11:48:53 +03:00

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 3039db1450
commit a4fae580a4

View File

@@ -493,7 +493,7 @@ typedef void* tjhandle;
* factor. This macro performs the integer equivalent of <tt>ceil(dimension *
* scalingFactor)</tt>.
*/
#define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \
#define TJSCALED(dimension, scalingFactor) (((dimension) * scalingFactor.num \
+ scalingFactor.denom - 1) / scalingFactor.denom)