[git commit master 1/1] sleep: tiny code shrink

Carmelo AMOROSO carmelo.amoroso at st.com
Fri Oct 22 13:52:30 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/22/2010 3:46 PM, Denys Vlasenko wrote:
> 
> commit: 
> http://git.uclibc.org/uClibc/commit/?id=e9b9c97c33c52e9eafaf6bf6d682e43ecfa3aea7
> branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master
> 
> ...or rather, it WILL BE code shrink when gcc become clever enough
> to not emit a second, useless XORing of ebx:
> 
> 31 db xor %ebx,%ebx
> 85 c0 test %eax,%eax
> 74 11 je 73 <__GI_sleep+0x73>
> 31 db xor %ebx,%ebx <=== ?!
> 
> Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>

too x86 oriented Denys !

Cheers,
Carmelo

> ---
> libc/unistd/sleep.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c
> index 438f5e2..6a237e3 100644
> --- a/libc/unistd/sleep.c
> +++ b/libc/unistd/sleep.c
> @@ -82,6 +82,10 @@ unsigned int sleep (unsigned int seconds)
> 
> /* Run nanosleep, with SIGCHLD blocked if SIGCHLD is SIG_IGNed. */
> result = nanosleep (&ts, &ts);
> + if (result != 0) {
> + /* Got EINTR. Return remaining time. */
> + result = (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L);
> + }
> 
> if (!__sigismember (&set, SIGCHLD)) {
> /* We did block SIGCHLD, and old mask had no SIGCHLD bit.
> @@ -91,10 +95,6 @@ unsigned int sleep (unsigned int seconds)
> sigprocmask (SIG_SETMASK, &set, NULL); /* never fails */
> }
> 
> - if (result != 0)
> - /* Round remaining time. */
> - result = (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L);
> -
> return result;
> }
> #endif
> --
> 1.7.1
> 
> _______________________________________________
> uClibc-cvs mailing list
> uClibc-cvs at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc-cvs
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzBlx4ACgkQoRq/3BrK1s9zfQCgzdQ6ytCGstzanNXLXaYKhgxs
sLsAmwbSk6sQVfpk6VAG/kHaTfWPAl9v
=317T
-----END PGP SIGNATURE-----


More information about the uClibc-cvs mailing list