Improve bcopy performance

Message ID 001d01d02e7a$6aeeff40$40ccfdc0$@com
State Committed
Headers

Commit Message

Wilco Dijkstra Jan. 12, 2015, 3:14 p.m. UTC
  Rather than using a C implementation of memmove, directly call memmove, which typically has a much
faster optimized implementation.

ChangeLog:

2015-01-12  Wilco Dijkstra  wdijkstr@arm.com

    * string/bcopy.c (bcopy): Call memmove for performance.

---
 string/bcopy.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
  

Comments

Roland McGrath Jan. 13, 2015, 6:40 p.m. UTC | #1
> +#include <stdarg.h>
>  #include <string.h>

There is no reason for this new #include.  Drop it.

Otherwise this is fine and I think it's safe enough during the freeze, but
there is no burning (melting?) reason to rush it if folks are feeling
conservative.
  
Roland McGrath Jan. 13, 2015, 7:10 p.m. UTC | #2
This is fine.  I think it's safe enough during the freeze, but there is no
burning (melting?) reason to rush it if folks are feeling conservative.
  
Wilco Dijkstra Feb. 27, 2015, 3:04 p.m. UTC | #3
> Roland McGrath wrote:
> > +#include <stdarg.h>
> >  #include <string.h>
> 
> There is no reason for this new #include.  Drop it.
> 
> Otherwise this is fine and I think it's safe enough during the freeze, but
> there is no burning (melting?) reason to rush it if folks are feeling
> conservative.

Commited without the include.

Wilco
  

Patch

diff --git a/string/bcopy.c b/string/bcopy.c
index f497b5d..b26f347 100644
--- a/string/bcopy.c
+++ b/string/bcopy.c
@@ -15,14 +15,11 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <stdarg.h>
 #include <string.h>
 
-#define	memmove		bcopy
-#define	rettype		void
-#define	RETURN(s)	return
-#define	a1		src
-#define	a1const		const
-#define	a2		dest
-#define	a2const
-
-#include <string/memmove.c>
+void
+bcopy (const void *src, void *dest, size_t len)
+{
+  memmove (dest, src, len);
+}