Ugly workaround for internal error in mspgcc when applying the >= operator to two 32-bit values
This commit is contained in:
parent
0c4c88ae66
commit
50e1452564
1 changed files with 5 additions and 2 deletions
|
@ -42,7 +42,7 @@
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: timer.c,v 1.5 2009/01/24 15:20:11 adamdunkels Exp $
|
* $Id: timer.c,v 1.6 2010/02/23 18:40:08 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
|
@ -121,7 +121,10 @@ timer_restart(struct timer *t)
|
||||||
int
|
int
|
||||||
timer_expired(struct timer *t)
|
timer_expired(struct timer *t)
|
||||||
{
|
{
|
||||||
return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
|
clock_time_t diff = clock_time() - t->start;
|
||||||
|
/* This somewhat ugly way of returning (diff >= t->interval) is
|
||||||
|
required to avoid an internal error in mspgcc. */
|
||||||
|
return diff > t->interval || diff == t->interval;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue