Compares values from two memory buffers.
Files
lib_mem.h/lib_mem.c
Prototype
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.
p2_mem
Pointer to the second memory buffer to compare.
size
Number of memory buffer octets to compare.
Returned Value
DEF_YES
,
if size number of octets are identical in both memory buffers;
DEF_NO
,
otherwise.
Required Configuration
None.
Notes / Warnings
Zero-sized compares allowed; DEF_YES
returned for identical NULL
compare.
Example Usage
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);