mailing list of musl libc
 help / color / mirror / code / Atom feed
8c8754869dfdbe4ad25dc7d34cfe42b82bb76e5a blob 608 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "word.h"

/**
 * memset - Word sized c standard memset.
 * @d: Destination
 * @c: Charater to set
 * @n: Max size to set to @c in @d
 */
void *memset(void *d, int c, size_t n)
{
	unsigned char *cd = (unsigned char *)d;
	const size_t wc = WORD_LSB_ONE * (unsigned char)c;
	size_t *wd;

	c = (unsigned char)c;

	for (; (uintptr_t)cd % sizeof(size_t); *cd++ = c, n--)
		if (!n) return d;

	for (wd = (size_t *)cd; n >= sizeof(size_t)
	     ; *wd++ = wc, n -= sizeof(size_t));
	for (cd = (unsigned char *)wd; n; *cd++ = c, n--);

	return d;
}
debug log:

solving 8c87548 ...
found 8c87548 in https://inbox.vuxu.org/musl/1359936735-31915-3-git-send-email-nwmcsween@gmail.com/
found 20e47c4 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 20e47c455640af415a751ad89559d4041f6eb5c5	src/string/memset.c

applying [1/1] https://inbox.vuxu.org/musl/1359936735-31915-3-git-send-email-nwmcsween@gmail.com/
diff --git a/src/string/memset.c b/src/string/memset.c
index 20e47c4..8c87548 100644

Checking patch src/string/memset.c...
Applied patch src/string/memset.c cleanly.

index at:
100644 8c8754869dfdbe4ad25dc7d34cfe42b82bb76e5a	src/string/memset.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).