Skip to content

shz_memcpy

Markdown
SHZ_INLINE void* shz_memcpy( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes) SHZ_NOEXCEPT;

Generic drop-in fast memcpy() replacement.

NameTypeDescription
dstvoid *SHZ_RESTRICT
srcconst void *SHZ_RESTRICT
bytessize_t

void *

Copies bytes from src to dst, determining the most efficient specialization to call into at run-time, returning dst.

There are no alignment or size requirements for this routine, but it is specifically optimized for 2-, 4-, 8-, and 32-byte alignments, with bigger alignments bringing bigger gainz.

  • When you know of and can control the src and dst alignments and batch sizes, you can micro-optimize by calling into the most specific memcpy() specialization for your given scenario, over just using this generic implementation, which must choose which one to use at run-time.
  • dst and src buffers should not be overlapping.
  • C++ equivalent: shz::memcpy
  • Type-generic form: none
  • Back-ends: SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
  • Defined in: sh4zam/shz_mem.h:75
  • Module: Memory, section "C stdlib Replacements"

shz_memcpy1, shz_memcpy2, shz_memcpy4, shz_memcpy8, shz_memcpy32, shz_memcpy64, shz_memcpy128