| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** my_memcmp | ||
| 4 | ** File description: | ||
| 5 | ** Compares the first (size) bytes | ||
| 6 | ** of the memory areas (pointer1) and (pointer2) | ||
| 7 | */ | ||
| 8 | /** | ||
| 9 | * @file my_memcmp.c | ||
| 10 | * @brief The file containing the my_memcmp function | ||
| 11 | * @author Nicolas TORO | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "mymemory.h" | ||
| 15 | |||
| 16 | 3 | int my_memcmp(const void *pointer1, const void *pointer2, size_t size) | |
| 17 | { | ||
| 18 | 3/4✓ Branch 0 taken 2 times. ✓ Branch 1 taken 1 times. ✗ Branch 2 not taken. ✓ Branch 3 taken 2 times. | 3 | if (pointer1 == NULL || pointer2 == NULL) | 
| 19 | 1 | return 0; | |
| 20 | 2/2✓ Branch 0 taken 11 times. ✓ Branch 1 taken 1 times. | 12 | for (size_t index = 0; index < size; index++) { | 
| 21 | 2/2✓ Branch 0 taken 1 times. ✓ Branch 1 taken 10 times. | 11 | if (((char *)pointer1)[index] != ((char *)pointer2)[index]) | 
| 22 | 1 | return ((char *)pointer1)[index] - ((char *)pointer2)[index]; | |
| 23 | } | ||
| 24 | 1 | return 0; | |
| 25 | } | ||
| 26 |