From b30e14c73acee81b9667667e958986a940883c91 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Tue, 14 Apr 2026 10:12:00 +1000 Subject: feat(common): Add ff_memcmp --- include/tinyff/common.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/tinyff/common.h b/include/tinyff/common.h index 39265a3..3653807 100644 --- a/include/tinyff/common.h +++ b/include/tinyff/common.h @@ -41,6 +41,15 @@ static inline size_t ff_strlen(const char *str) return len; } +static inline int ff_memcmp(const void *a, const void *b, size_t n) +{ + const uint8_t *pa = (const uint8_t *)a; + const uint8_t *pb = (const uint8_t *)b; + for (size_t i = 0; i < n; i++) { + if (pa[i] != pb[i]) return pa[i] - pb[i]; + } + return 0; +} // Context bases // Default -- cgit v1.2.3