diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 10:12:00 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 10:12:00 +1000 |
| commit | b30e14c73acee81b9667667e958986a940883c91 (patch) | |
| tree | 7370bd189935df73bcad2909d8edd348feba58fd | |
| parent | e5c55e9b54a285164d3573a098308ad075c1e1e7 (diff) | |
feat(common): Add ff_memcmp
| -rw-r--r-- | include/tinyff/common.h | 9 |
1 files changed, 9 insertions, 0 deletions
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 |
