diff options
author | ed <ed@FreeBSD.org> | 2012-01-01 20:26:11 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-01-01 20:26:11 +0000 |
commit | a201da71788983b3f0445aa46bca32751fc7393c (patch) | |
tree | af6bd36dd5b255501e8018e450b5f00a332c52cb /sys/sys | |
parent | 4a643207b240e975c07808e969d7545d1d8c0b31 (diff) | |
download | FreeBSD-src-a201da71788983b3f0445aa46bca32751fc7393c.zip FreeBSD-src-a201da71788983b3f0445aa46bca32751fc7393c.tar.gz |
Introducing memcchr(3).
It seems two of the file system drivers we have in the tree, namely ufs
and ext3, use a function called `skpc()'. The meaning of this function
does not seem to be documented in FreeBSD, but it turns out one needs to
be a VAX programmer to understand what it does.
SPKC is an instruction on the VAX that does the opposite of memchr(). It
searches for the non-equal character. Add a new function called
memcchr() to the tree that has the following advantages over skpc():
- It has a name that makes more sense than skpc(). Just like strcspn()
matches the complement of strspn(), memcchr() is the complement of
memchr().
- It is faster than skpc(). Similar to our strlen() in libc, it compares
entire words, instead of single bytes. It seems that for this routine
this yields a sixfold performance increase on amd64.
- It has a man page.
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/libkern.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index aa53fb7..0e525de 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -92,6 +92,7 @@ int flsl(long); int fnmatch(const char *, const char *, int); int locc(int, char *, u_int); void *memchr(const void *s, int c, size_t n); +void *memcchr(const void *s, int c, size_t n); int memcmp(const void *b1, const void *b2, size_t len); void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); |