27 #include <sys/cdefs.h>
30 #include <sys/libkern.h>
31 #include <sys/types.h>
32 #include <sys/limits.h>
34 #define IDX(c) ((u_char)(c) / LONG_BIT)
35 #define BIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT))
38 strcspn(
const char * __restrict s,
const char * __restrict charset)
46 u_long tbl[(UCHAR_MAX + 1) / LONG_BIT];
54 tbl[3] = tbl[2] = tbl[1] = 0;
56 for (tbl[0] = idx = 1; idx <
sizeof(tbl) /
sizeof(tbl[0]); idx++)
59 for (; *charset !=
'\0'; charset++) {
68 if ((tbl[idx] & bit) != 0)
size_t strcspn(const char *__restrict s, const char *__restrict charset)