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:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user