mailing list of musl libc
 help / color / mirror / code / Atom feed
27b6d37a3f607aa13a6a8a88ae9c30d8aaff084c blob 494 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include <string.h>
#include <stdint.h>
#include <limits.h>

#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)

size_t strlen(const char *s)
{
	const char *a = s;
#ifdef __GNUC__
	const __attribute__((__may_alias__)) size_t *w;
	for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a;
	for (w = (const void *)s; !HASZERO(*w); w++);
	s = (const void *)w;
#endif
	for (; *s; s++);
	return s-a;
}
debug log:

solving 27b6d37 ...
found 27b6d37 in https://inbox.vuxu.org/musl/20180923003542.GC17995@brightrain.aerifal.cx/ ||
	https://inbox.vuxu.org/musl/20160427220105.GA12289@brightrain.aerifal.cx/
found 929ddcb in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 929ddcbc1c2594762c7b44cdfd5edf0f2955d1f6	src/string/strlen.c

applying [1/2] https://inbox.vuxu.org/musl/20180923003542.GC17995@brightrain.aerifal.cx/
diff --git a/src/string/strlen.c b/src/string/strlen.c
index 929ddcb..27b6d37 100644

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

skipping https://inbox.vuxu.org/musl/20160427220105.GA12289@brightrain.aerifal.cx/ for 27b6d37
index at:
100644 27b6d37a3f607aa13a6a8a88ae9c30d8aaff084c	src/string/strlen.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).