Changeset View
Changeset View
Standalone View
Standalone View
head/sys/libkern/strlen.c
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define testbyte(x) \ | #define testbyte(x) \ | ||||
do { \ | do { \ | ||||
if (p[x] == '\0') \ | if (p[x] == '\0') \ | ||||
return (p - str + x); \ | return (p - str + x); \ | ||||
} while (0) | } while (0) | ||||
size_t | size_t | ||||
strlen(const char *str) | (strlen)(const char *str) | ||||
{ | { | ||||
const char *p; | const char *p; | ||||
const unsigned long *lp; | const unsigned long *lp; | ||||
long va, vb; | long va, vb; | ||||
/* | /* | ||||
* Before trying the hard (unaligned byte-by-byte access) way | * Before trying the hard (unaligned byte-by-byte access) way | ||||
* to figure out whether there is a nul character, try to see | * to figure out whether there is a nul character, try to see | ||||
Show All 39 Lines |