A and B are binary o string data pointers length the max lenght to check. Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow */
| 5965 | Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow |
| 5966 | */ |
| 5967 | int minimum_same_bytes(unsigned char* A,unsigned char* B, int length) { |
| 5968 | int minBytes = 0; // Assume initially that all bytes are the same |
| 5969 | if(A == NULL || B == NULL) { // In case of some NULL pointer |
| 5970 | return 0; |
| 5971 | } |
| 5972 | for (int i = 0; i < length; i++) { |
| 5973 | if (A[i] != B[i]) { |
| 5974 | break; // Exit the loop since we found a mismatch |
| 5975 | } |
| 5976 | minBytes++; // Update the minimum number of bytes where data is the same |
| 5977 | } |
| 5978 | |
| 5979 | return minBytes; |
| 5980 | } |
| 5981 | |
| 5982 | void checkpointer(void *ptr,const char *file,const char *function,const char *name,int line) { |
| 5983 | if(ptr == NULL) { |