summaryrefslogtreecommitdiff
path: root/test/number.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2018-07-28 14:27:28 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2018-07-28 14:27:28 +0100
commita0fcc8e5dee6f61c12ce44503edd26e699d5e663 (patch)
treed603b975ceef15a2fe14915427ec8da3960fa544 /test/number.c
parentf4e28a9fbd87f652c1e1428f5c576786b41d4f10 (diff)
downloadlibcss-a0fcc8e5dee6f61c12ce44503edd26e699d5e663.tar.gz
libcss-a0fcc8e5dee6f61c12ce44503edd26e699d5e663.tar.bz2
Tests: Fix undefined behaviour in css_fixed printing.
test/number.c:137:22: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Diffstat (limited to 'test/number.c')
-rw-r--r--test/number.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/number.c b/test/number.c
index d255f4c..7b0d10f 100644
--- a/test/number.c
+++ b/test/number.c
@@ -133,7 +133,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen)
void print_css_fixed(char *buf, size_t len, css_fixed f)
{
-#define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x))
+#define ABS(x) (uint32_t)((x) < 0 ? -((int64_t)x) : (x))
uint32_t uintpart = FIXTOINT(ABS(f));
/* + 500 to ensure round to nearest (division will truncate) */
uint32_t fracpart = ((ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10);