From 250129a53a803f2c5c1359f89f1e9a834e8c37a7 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Wed, 7 Dec 2011 20:05:19 -0700 Subject: [PATCH] Ensure proper behavior in timer_cwait Ah, the Hi-Tech compiler's lovely interpretation of promotions. See 3.6.1, Integral Promotion. This may affect the conditional in timer_cwait(), so force a cast of the result to be sure it is correct. --- timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timer.h b/timer.h index c28ed0b..20e0c8b 100644 --- a/timer.h +++ b/timer.h @@ -44,7 +44,7 @@ #define timer_cwait(c) \ { \ unsigned t0 = TMR0; \ - while ((TMR0 - t0) <= c); \ + while ((unsigned)(TMR0 - t0) <= c); /* cast prevents integral promotion */ \ } while (0) void timer_uwait(unsigned us); -- 2.39.2