#include "strchrnul.h"
#include <stdint.h>
#include <string.h>
Go to the source code of this file.
|
#define | BITOP(a, b, op) ((a)[(size_t)(b) / (8 * sizeof *(a))] op(size_t) 1 << ((size_t)(b) % (8 * sizeof *(a)))) |
|
|
size_t | strcspn (const char *s, const char *c) |
|
◆ BITOP
#define BITOP |
( |
|
a, |
|
|
|
b, |
|
|
|
op |
|
) |
| ((a)[(size_t)(b) / (8 * sizeof *(a))] op(size_t) 1 << ((size_t)(b) % (8 * sizeof *(a)))) |
◆ strcspn()
size_t strcspn |
( |
const char * |
s, |
|
|
const char * |
c |
|
) |
| |
Definition at line 8 of file strcspn.c.
11 size_t byteset[32 /
sizeof(size_t)];
15 return (uintptr_t)(
__strchrnul(s, *c) - (uintptr_t)a);
18 memset(byteset, 0,
sizeof byteset);
19 for(; *c &&
BITOP(byteset, *(
const unsigned char*)c, |=); c++)
25 for(; *s && !
BITOP(byteset, *(
const unsigned char*)s, &); s++)
31 return (uintptr_t)s - (uintptr_t)a;
char * __strchrnul(const char *, int)
void * memset(void *dest, int c, size_t n)
Copies the value c into each of the first n characters of the object pointed to by dest.
References __strchrnul(), BITOP, and memset().
Referenced by strpbrk().