Skip to content
Commit 06438b0d authored by Dimitry Kloper's avatar Dimitry Kloper Committed by Gregory Nutt
Browse files

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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment