Mem_Move()

Move data octets from one memory buffer to another memory buffer, or within the same memory buffer. Overlapping is properly handled for all move operations.

Files

lib_mem.h/lib_mem.c

Prototype

          void  Mem_Move (       void        *pdest,
                          const  void        *psrc,
                                 CPU_SIZE_T   size);

Arguments

pdest

Pointer to the destination memory buffer.

psrc

Pointer to the source memory buffer.

size

Number of octets to move.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

  1. Zero-sized copies allowed.
  2. Memory buffers checked for overlapping.
  3. This function can be configured to build an assembly-optimized version.

Example Usage

          CPU_INT08U  DataBuf[20];
                                                  /* Set  data buffer with value.    */
          Mem_Set ((void     *)&DataBuf[0],
                   (CPU_INT08U) 0x64,
                   (CPU_SIZE_T) sizeof(DataBuf));
                                                  /* Move data within data buffer.   */
          Mem_Move((void     *)&DataBuf[1],
                   (void     *)&DataBuf[0],
                                19);