Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
|
Go to the source code of this file.
Macros | |
#define | SS (sizeof(size_t)) |
#define | ALIGN (sizeof(size_t) - 1) |
#define | ONES ((size_t)-1 / UCHAR_MAX) |
#define | HIGHS (ONES * (UCHAR_MAX / 2 + 1)) |
#define | HASZERO(x) ((x)-ONES & ~(x)&HIGHS) |
Functions | |
void * | memchr (const void *src, int c, size_t n) |
Finds the first occurrence of c in the initial n characters of the object pointed to by s. More... | |
void* memchr | ( | const void * | s, |
int | c, | ||
size_t | n | ||
) |
Finds the first occurrence of c in the initial n characters of the object pointed to by s.
Finds the first occurrence of c (after conversion to unsigned char as if by (unsigned char)c ) in the initial n characters (each interpreted as unsigned char) of the object pointed to by s.
The behavior is undefined if access occurs beyond the end of the array (s) searched. The behavior is undefined if s is a null pointer.
s | pointer to the object to be examined |
c | character to search for |
n | max number of characters to examine |
Definition at line 13 of file memchr.c.
References __attribute__(), ALIGN, HASZERO, ONES, and SS.
Referenced by memmem().