summaryrefslogtreecommitdiff
path: root/zap/source/any/mem/eq.c
diff options
context:
space:
mode:
Diffstat (limited to 'zap/source/any/mem/eq.c')
-rw-r--r--zap/source/any/mem/eq.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/zap/source/any/mem/eq.c b/zap/source/any/mem/eq.c
new file mode 100644
index 0000000..0229fb6
--- /dev/null
+++ b/zap/source/any/mem/eq.c
@@ -0,0 +1,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;
+}