This is the mail archive of the
mailing list for the glibc project.
Re: Should we optimize memset to bzero?
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: Re: Should we optimize memset to bzero?
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 2 Nov 2001 17:38:00 +0100
- Cc: GNU C Library <libc-alpha at sources dot redhat dot com>
- References: <20011102082849.A7990@lucon.org>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Fri, Nov 02, 2001 at 08:28:49AM -0800, H . J . Lu wrote:
> Should we optimize memset to bzero? Like
> #define memset(s, c, n) \
> (__extension__ ((__builtin_constant_p (c) && (c) == 0) \
> ? __bzero ((s), (n)) : __memset ((s), (c), (n)))
And we don't? Look at bits/string2.h...
I would say with bits/string*.h exactly the opposite is needed, we need to
check whether the glibc optimizations are still optimizations or whether gcc
does better job (in many cases it does). In the latter case, such code
should be !__GNUC_PREREQ(3,0)'ed.