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.
parent
ae71c9b4
Please register or sign in to comment