Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
memrchr.c
Go to the documentation of this file.
1 // Imported from musl Libc
2 
3 #include <string.h>
4 
5 void* __memrchr(const void* /*m*/ /*m*/, int /*c*/ /*c*/, size_t /*n*/ /*n*/);
6 
7 void* __memrchr(const void* m, int c, size_t n)
8 {
9  const unsigned char* s = m;
10  c = (unsigned char)c;
11 
12  while(n--)
13  {
14  if(s[n] == c)
15  {
16  return (void*)(uintptr_t)(s + n);
17  }
18  }
19 
20  return 0;
21 }
void * __memrchr(const void *, int, size_t)
Definition: memrchr.c:7