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.
#define timer_cwait(c) \
{ \
unsigned t0 = TMR0; \
#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);
} while (0)
void timer_uwait(unsigned us);