summaryrefslogtreecommitdiff
path: root/lib/memset.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/memset.c')
-rw-r--r--lib/memset.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/lib/memset.c b/lib/memset.c
index cb378ff..ddf42f8 100644
--- a/lib/memset.c
+++ b/lib/memset.c
@@ -1,39 +1,10 @@
-/**
-** @file memset.c
-**
-** @author Numerous CSCI-452 classes
-**
-** @brief C implementations of common library functions
-*/
+#include <string.h>
-#ifndef MEMSET_SRC_INC
-#define MEMSET_SRC_INC
-
-#include <common.h>
-
-#include <lib.h>
-
-/**
-** memset(buf,len,value)
-**
-** initialize all bytes of a block of memory to a specific value
-**
-** @param buf The buffer to initialize
-** @param len Buffer size (in bytes)
-** @param value Initialization value
-*/
-void memset(void *buf, register uint32_t len, register uint32_t value)
+void *memset(void *dest, int c, size_t n)
{
- register uint8_t *bp = buf;
-
- /*
- ** We could speed this up by unrolling it and copying
- ** words at a time (instead of bytes).
- */
-
- while (len--) {
- *bp++ = value;
- }
+ unsigned char *d = dest;
+ for (; n; n--) {
+ *d++ = c;
+ };
+ return dest;
}
-
-#endif