summaryrefslogtreecommitdiff
path: root/zp/source/any/mem/memsrh.c
blob: e85b2297098da52e28ea6ff369dbea2d54bd68af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
	Copyright 2022-2023 Gabriel Jensen.
	This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
	If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/

#include <zp/mem.h>

void * zp_memsrh(void const * const bufptr,char unsigned const val,zp_siz const num) {
	char unsigned const * buf = bufptr;

	char unsigned const * const stp = buf+num;
		
	while (buf != stp) {
		char unsigned const * const addr = buf++;
		
		zp_ulik (*addr == val) {return (char unsigned *)addr;}
	}

	return zp_nulptr;
}