public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Implement bzero() via memset()
@ 2017-07-04 13:34 Sebastian Huber
  2017-07-04 13:34 ` [PATCH 2/3] Synchronize <strings.h> with latest FreeBSD Sebastian Huber
  2017-07-04 13:34 ` [PATCH 3/3] Add ffsl(), ffsll(), fls(), flsl(), flsll() Sebastian Huber
  0 siblings, 2 replies; 16+ messages in thread
From: Sebastian Huber @ 2017-07-04 13:34 UTC (permalink / raw)
  To: newlib

Use memset() to implement bzero() to profit from machine-specific
memset() optimizations.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/libc/string/bzero.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/newlib/libc/string/bzero.c b/newlib/libc/string/bzero.c
index dbcae02d6..e99529af6 100644
--- a/newlib/libc/string/bzero.c
+++ b/newlib/libc/string/bzero.c
@@ -30,14 +30,11 @@ Neither ANSI C nor the System V Interface Definition (Issue 2) require
 <<bzero>> requires no supporting OS subroutines.
 */
 
-#include <strings.h>
+#include <string.h>
 
-_VOID
-_DEFUN (bzero, (b, length),
-	void *b _AND
-	size_t length)
+void
+bzero(void *b, size_t length)
 {
-  char *ptr = (char *)b;
-  while (length--)
-    *ptr++ = 0;
+
+	memset(b, 0, length);
 }
-- 
2.12.3

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-07-27  7:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04 13:34 [PATCH 1/3] Implement bzero() via memset() Sebastian Huber
2017-07-04 13:34 ` [PATCH 2/3] Synchronize <strings.h> with latest FreeBSD Sebastian Huber
2017-07-04 13:34 ` [PATCH 3/3] Add ffsl(), ffsll(), fls(), flsl(), flsll() Sebastian Huber
2017-07-05  6:06   ` Sebastian Huber
2017-07-05  8:42     ` Corinna Vinschen
2017-07-05  8:54   ` [PATCH v2 " Sebastian Huber
2017-07-05 11:26     ` Corinna Vinschen
2017-07-27  1:40       ` Kito Cheng
2017-07-27  5:47         ` Sebastian Huber
2017-07-27  6:21           ` Sebastian Huber
2017-07-27  6:38             ` Kito Cheng
2017-07-27  6:40               ` Kito Cheng
2017-07-27  6:50         ` Sebastian Huber
2017-07-27  6:53           ` Kito Cheng
2017-07-27  7:09             ` Sebastian Huber
2017-07-27  7:21               ` Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).