* src/atomic_ops.c [AO_USE_NANOSLEEP] (AO_pause): Use "L" suffix for
shifted immediate value (1) to match the type of ts.tv_nsec.
* src/atomic_ops.c [!AO_USE_NANOSLEEP && AO_USE_WIN32_PTHREADS]
(AO_pause): Cast shifted immediate value (1) to DWORD to match Sleep
argument type.
* src/atomic_ops.c [!AO_USE_NANOSLEEP && !AO_USE_WIN32_PTHREADS]
(AO_pause): Store computed usec value to an intermediate int variable
(before storing it to tv.tv_usec) so that to avoid widening conversion
of shifted immediate int value (1); add comment.
# ifdef AO_USE_NANOSLEEP
struct timespec ts;
ts.tv_sec = 0;
- ts.tv_nsec = (n > 28 ? 100000 * 1000 : 1 << (n - 2));
+ ts.tv_nsec = n > 28 ? 100000L * 1000 : 1L << (n - 2);
nanosleep(&ts, 0);
# elif defined(AO_USE_WIN32_PTHREADS)
- Sleep(n > 28 ? 100 : n < 22 ? 1 : 1 << (n - 22)); /* in millis */
+ Sleep(n > 28 ? 100 /* millis */
+ : n < 22 ? 1 : (DWORD)1 << (n - 22));
# else
struct timeval tv;
/* Short async-signal-safe sleep. */
+ int usec = n > 28 ? 100000 : 1 << (n - 12);
+ /* Use an intermediate variable (of int type) to avoid */
+ /* "shift followed by widening conversion" warning. */
+
tv.tv_sec = 0;
- tv.tv_usec = n > 28 ? 100000 : 1 << (n - 12);
+ tv.tv_usec = usec;
select(0, 0, 0, 0, &tv);
# endif
}