diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-03 12:30:34 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-03 12:30:34 -0400 |
commit | ec3c37d1d40d7b288584c234f4c3e7a600f2353d (patch) | |
tree | bb587b33c4c793ff7a3317dfa958d69b0fa318a1 /lib/memset.c | |
parent | move boot only headers to boot (diff) | |
download | comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.tar.gz comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.tar.bz2 comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.zip |
new libs
Diffstat (limited to 'lib/memset.c')
-rw-r--r-- | lib/memset.c | 43 |
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 |