From 257666499deef1e6ff03c9167c282a5aead8fc6f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Aug 2015 22:42:54 +0100 Subject: Reorder percentage calculation. Fixed point representation couldn't store 0.65 exactly, so avoid doing the divide by 100 first. I will look at moving this into libcss's fixed point header and doing it in a way that avoids arithmetic overflow, but for now this fixes el reg layout. --- render/layout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/layout.c b/render/layout.c index 4539867d0..a54d324fc 100644 --- a/render/layout.c +++ b/render/layout.c @@ -67,8 +67,8 @@ #define AUTO INT_MIN -/* Fixed point value percentage of an integer, to an integer */ -#define FPCT_OF_INT_TOINT(a, b) FIXTOINT(FMUL(FDIV(a, F_100), INTTOFIX(b))) +/* Fixed point percentage (a) of an integer (b), to an integer */ +#define FPCT_OF_INT_TOINT(a, b) (FIXTOINT(FDIV((a * b), F_100))) static bool layout_block_context(struct box *block, int viewport_height, -- cgit v1.2.3