mailing list of musl libc
 help / color / mirror / code / Atom feed
774829dd515667b01fbba507d819b58c7ee74857 blob 536 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>

#define LOWS(x) (((x)*0-1) / 255)

void *memset(void *d, int c, size_t n)
{
	unsigned char *cd = (unsigned char *)d;
	const size_t wc = LOWS(wc) * (unsigned char)c;
	size_t *wd;

	c = (unsigned char)c;

	if (n < sizeof(size_t)) goto bytewise;

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

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

bytewise:
	for (; n; *cd++ = c, n--);

	return d;
}
debug log:

solving 774829d ...
found 774829d in https://inbox.vuxu.org/musl/1365280696-16525-2-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/1365280696-16525-2-git-send-email-nwmcsween@gmail.com/
diff --git a/src/string/memset.c b/src/string/memset.c
index 20e47c4..774829d 100644

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

index at:
100644 774829dd515667b01fbba507d819b58c7ee74857	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).