...
lib_mem.h/lib_mem.c
Prototype
Code Block | ||
---|---|---|
| ||
CPU_BOOLEAN Mem_Cmp (const void *p1_mem,
const void *p2_mem,
CPU_SIZE_T size); |
Arguments
p1_mem
Pointer to the first memory buffer to compare.
...
Zero-sized compares allowed; DEF_YES
returned for identical NULL
compare.
Example Usage
Code Block | ||
---|---|---|
| ||
CPU_INT08U DataBuf_1[10];
CPU_INT08U DataBuf_2[20];
CPU_SIZE_T size;
CPU_BOOLEAN cmp;
/* Set data buffers with values. */
Mem_Set((void *)&DataBuf_1[0],
(CPU_INT08U) 0x64,
(CPU_SIZE_T) sizeof(DataBuf_1));
Mem_Set((void *)&DataBuf_2[0],
(CPU_INT08U) 0x33,
(CPU_SIZE_T) sizeof(DataBuf_2));
/* Compare data buffers' values. */
size = DEF_MIN(sizeof(DataBuf_1),
sizeof(DataBuf_2));
cmp = Mem_Cmp((void *)&DataBuf_1[0],
(void *)&DataBuf_2[0],
(CPU_SIZE_T) cmp_size); |