Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

lib_mem.h/lib_mem.c

Prototype

Code Block
LanguageC++
CaptionTextCAPTION
languagecpp
          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

CAPTION
Code Block
LanguageC++
CaptionText
languagecpp
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);

...