summaryrefslogtreecommitdiff
path: root/zap/source/any/mem/eq.c
blob: 0229fb60e9853045ad9b8c6d7ba9a09d34c32aba (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_bool zap_eq(void const * const _lbuf,void const * const _rbuf,zap_sz const _num) {
	zap_byte const * lbuf;
	zap_byte const * rbuf;
	zap_byte * const stop = (zap_byte *)_lbuf + _num;
	for (lbuf = _lbuf,rbuf = _rbuf;lbuf != stop;++lbuf,++rbuf) {
		if (*lbuf != *rbuf) {
			return zap_false;
		}
	}
	return zap_true;
}