From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- rushs/tinyprintf/my_memcmp/my_memcmp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 rushs/tinyprintf/my_memcmp/my_memcmp.c (limited to 'rushs/tinyprintf/my_memcmp/my_memcmp.c') diff --git a/rushs/tinyprintf/my_memcmp/my_memcmp.c b/rushs/tinyprintf/my_memcmp/my_memcmp.c new file mode 100644 index 0000000..d498360 --- /dev/null +++ b/rushs/tinyprintf/my_memcmp/my_memcmp.c @@ -0,0 +1,18 @@ +#include "my_memcmp.h" + +int my_memcmp(const void *s1, const void *s2, size_t num) +{ + if (num == 0) + { + return 0; + } + const unsigned char *a = s1; + const unsigned char *b = s2; + + for (; num - 1 && *a == *b; a++, b++, num--) + { + continue; + } + + return *a - *b; +} -- cgit v1.2.3