Fix 64-bit clock-related constant value evaluation for AVR compiler
This may be specific for Atmel AVR8 toolchain compiler. The problem is that despite of being 8-bit architecture avr-gcc supports uint64_t, but the following code uint64_t value = 10000 * 1000; produces a wrong negative value in the final code (tested both with and without optimization). The work-around is simple: uint64_t value = 10000 * 1000L; The code is a reduced part from sched/signal/sig_timedwait.c where waitticks64 is calculated using NSEC_PER_TICK. This one is defined as USEC_PER_TICK * NSEC_PER_USEC which leads to the example above.
This commit is contained in:
parent
ae71c9b447
commit
06438b0dcc
|
@ -98,16 +98,16 @@
|
|||
|
||||
/* Timing constants *********************************************************/
|
||||
|
||||
#define NSEC_PER_SEC 1000000000
|
||||
#define USEC_PER_SEC 1000000
|
||||
#define MSEC_PER_SEC 1000
|
||||
#define DSEC_PER_SEC 10
|
||||
#define NSEC_PER_DSEC 100000000
|
||||
#define USEC_PER_DSEC 100000
|
||||
#define MSEC_PER_DSEC 100
|
||||
#define NSEC_PER_MSEC 1000000
|
||||
#define USEC_PER_MSEC 1000
|
||||
#define NSEC_PER_USEC 1000
|
||||
#define NSEC_PER_SEC 1000000000L
|
||||
#define USEC_PER_SEC 1000000L
|
||||
#define MSEC_PER_SEC 1000L
|
||||
#define DSEC_PER_SEC 10L
|
||||
#define NSEC_PER_DSEC 100000000L
|
||||
#define USEC_PER_DSEC 100000L
|
||||
#define MSEC_PER_DSEC 100L
|
||||
#define NSEC_PER_MSEC 1000000L
|
||||
#define USEC_PER_MSEC 1000L
|
||||
#define NSEC_PER_USEC 1000L
|
||||
|
||||
/* If CONFIG_SCHED_TICKLESS is not defined, then the interrupt interval of
|
||||
* the system timer is given by USEC_PER_TICK. This is the expected number
|
||||
|
|
Loading…
Reference in New Issue