libcsdbg  1.28
C++ exception (and generic) stack trace debug library
void * csdbg::util::memcpy ( void *  dst,
const void *  src,
u32  sz 
)
static

Copy a memory block.

Parameters
[in,out]dstthe destination base address
[in]srcthe source base address
[in]szthe block size
Returns
the first argument
Note
This method is used for portability (in place of BSD's bcopy)

Definition at line 347 of file util.cpp.

References __D_ASSERT, likely, and unlikely.

348 {
349  __D_ASSERT(dst != NULL);
350  __D_ASSERT(src != NULL);
351  if ( unlikely(dst == NULL || src == NULL) )
352  return dst;
353 
354  u8 *d = static_cast<u8*> (dst);
355  const u8 *s = static_cast<const u8*> (src);
356  while ( likely(sz-- > 0) )
357  *(d++) = *(s++);
358 
359  return dst;
360 }
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
unsigned char u8
8-bit unsigned integer
Definition: config.hpp:92
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268