summaryrefslogtreecommitdiff
path: root/zap/source/any/mem/eq.c
blob: 3f6cd8e9ac5c82e0a87be55ebd9b82432d39f6c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
	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 <zap/mem.h>

zap_i8 zap_eq(void const * const _lbuf,void const * const _rbuf,zap_sz const _num) {
	zap_i8 const *       lbuf;
	zap_i8 const *       rbuf;
	zap_i8 *       const stop = (zap_i8 *)_lbuf + _num;
	for (lbuf = _lbuf,rbuf = _rbuf;lbuf != stop;++lbuf,++rbuf) {
		if (*lbuf != *rbuf) {
			return 0x0u;
		}
	}
	return 0x1u;
}