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 */
| 6219 | Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow |
| 6220 | */ |
| 6221 | int minimum_same_bytes(unsigned char* A,unsigned char* B, int length) { |
| 6222 | int minBytes = 0; // Assume initially that all bytes are the same |
| 6223 | if(A == NULL || B == NULL) { // In case of some NULL pointer |
| 6224 | return 0; |
| 6225 | } |
| 6226 | for (int i = 0; i < length; i++) { |
| 6227 | if (A[i] != B[i]) { |
| 6228 | break; // Exit the loop since we found a mismatch |
| 6229 | } |
| 6230 | minBytes++; // Update the minimum number of bytes where data is the same |
| 6231 | } |
| 6232 | |
| 6233 | return minBytes; |
| 6234 | } |
| 6235 | |
| 6236 | void checkpointer(void *ptr,const char *file,const char *function,const char *name,int line) { |
| 6237 | if(ptr == NULL) { |