aboutsummaryrefslogtreecommitdiffstats
path: root/memory/memrchr.c
blob: 6413808bb8f8032cf090647328e38f6301b1400f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#include "memory.h"

void *memrchr(void const *buf, int value, size_t size)
{
	unsigned char const *buffer = buf;
	for (size_t i = size; i-- > 0;)
		if (buffer[i] == (unsigned char)value)
			return (void *)&buffer[i];
	return NULL;
}