>>>>> "Denys" == Denys Vlasenko <[email protected]> writes:

Hi,

 >> int usleep (__useconds_t usec)
 >> {
 >> const struct timespec ts = {
 >> .tv_sec = (long int) (usec / 1000000),

 Denys> what is the purpose of this cast?
 Denys> If anything, (unsligned long)usec / 1000000
 Denys> may make more sense - unsigned division is easier.

 >> .tv_nsec = (long int) (usec % 1000000) * 1000ul

 Denys> Unless gcc is clever enough to notice it and optimize it out,
 Denys> you use long multiply where int multiply will do.

This was purely a cut'n'paste from the uclibc implementation -
libc/unistd/usleep.c

 Denys> But please wrap it in #ifs so that if usleep _is_ available,
 Denys> we do not duplicate it.

The question is what this define should be - Do you want a visible
CONFIG_HAVE_USLEEP or can we do anything clever about autodetecting
usleep (I don't quite see how)?

-- 
Bye, Peter Korsgaard
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to