diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2015-08-24 22:42:54 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2015-08-24 22:47:58 +0100 |
commit | 257666499deef1e6ff03c9167c282a5aead8fc6f (patch) | |
tree | 491735417cd76768c82548f8dbded729b737b2df | |
parent | 914ba332e2853baa30809eda11a878ab686253f6 (diff) | |
download | netsurf-257666499deef1e6ff03c9167c282a5aead8fc6f.tar.gz netsurf-257666499deef1e6ff03c9167c282a5aead8fc6f.tar.bz2 |
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.
-rw-r--r-- | render/layout.c | 4 |
1 files 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, |