diff options
Diffstat (limited to 'include')
| -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 |
