From 83e47dfd5b5774762ca53f2aaf29a3fd8cb27ae4 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Sat, 24 Jan 2009 00:57:14 +0000 Subject: Fix handling of max -ve numbers svn path=/trunk/libcss/; revision=6214 --- test/data/number/number.dat | 5 ++--- test/number.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/data/number/number.dat b/test/data/number/number.dat index 1004f55..f2cc2f4 100644 --- a/test/data/number/number.dat +++ b/test/data/number/number.dat @@ -64,17 +64,16 @@ -2097151.000 #reset -# TODO: should these next two not result in INT_MIN? #data -2097152 #expected --2097151.999 +-2097152 #reset #data -2097153 #expected --2097151.999 +-2097152 #reset #data diff --git a/test/number.c b/test/number.c index 46b2fda..dd44730 100644 --- a/test/number.c +++ b/test/number.c @@ -127,7 +127,7 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) void print_fixed(char *buf, size_t len, fixed f) { -#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define ABS(x) (uint32_t)((x) < 0 ? -(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); -- cgit v1.2.3