mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-18 23:11:19 +03:00
20 lines
268 B
C
Executable File
20 lines
268 B
C
Executable File
/*
|
|
* memrchr.c
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
void *memrchr(const void *s, int c, size_t n)
|
|
{
|
|
const unsigned char *sp = (const unsigned char *)s + n - 1;
|
|
|
|
while (n--) {
|
|
if (*sp == (unsigned char)c)
|
|
return (void *)sp;
|
|
sp--;
|
|
}
|
|
|
|
return NULL;
|
|
}
|