   mmx memcpy
  I''m searching a fast mmx memcpy function. Have you a link or some tips please ?Chuck 
  You are in luck, I originally found this mmx_memcpy in the PTC source, and adapted it to work for sizes < 32 bytes as well.  There is also a mmx_memset function. ;; TinyPTC by Gaffer; www.gaffer.org/tinyptc; Modifications by Gladius;bits 32global _mmx_memsetglobal _mmx_memcpysection .dataalign 16section .textalign 16_mmx_memset:push ebpmov ebp,esppushadmov edi,[ebp+8]; Destinationmov eax,[ebp+12]; Valuemov ecx,[ebp+16]; Bytes    mov edx,ecx    shr ecx,6    mov ebx,ecx    shl ebx,6    sub edx,ebx; edx holds # of overflow bytesmov [edi],eaxmov [edi+4],eaxmovq mm0,[edi]cmp ecx,0je .doneloop.setloop   movq [edi],mm0   movq [edi+8],mm0   movq [edi+16],mm0   movq [edi+24],mm0movq [edi+32],mm0   movq [edi+40],mm0   movq [edi+48],mm0   movq [edi+56],mm0   add edi,8*8   dec ecxjnz .setloop.doneloopmov ecx,edxshr ecx,2rep stosdemmspopadpop ebpretalign 16_mmx_memcpy:    push ebp    mov ebp,esp    pushad    mov edi,[ebp+8]  ; destination    mov esi,[ebp+12] ; source    mov ecx,[ebp+16] ; bytes    mov eax,ecx    shr ecx,6    mov ebx,ecx    shl ebx,6    sub eax,ebxcmp ecx,0je .donealign 16  .loop   movq mm0,[esi]   movq mm1,[esi+8]   movq mm2,[esi+16]   movq mm3,[esi+24]   movq mm4,[esi+32]   movq mm5,[esi+40]   movq mm6,[esi+48]   movq mm7,[esi+56]   movq [edi],mm0   movq [edi+8],mm1   movq [edi+16],mm2   movq [edi+24],mm3   movq [edi+32],mm4   movq [edi+40],mm5   movq [edi+48],mm6   movq [edi+56],mm7   add esi,8*8   add edi,8*8   dec ecxjnz .loop.done    mov ecx,eax    rep movsb    emms    popad   pop ebp    retThe C/C++ header includes for MSVC are extern "C" {void __cdecl mmx_memcpy(void *d,void *s,int bytes);void __cdecl mmx_memset(void *d,u32 val,int bytes);}Compile the asm source with nasm, then just link it into your project.  I do this with a custom build step as follows:Command line: nasmw -o "$(TargetDir)$(InputName).obj" -f win32 "$(InputDir)$(InputName).asm"Outputs: $(TargetDir)$(InputName).objThen you should be set to go. ; Here  is a paper that goes through various stages of optimization... eventually gets to 300% faster than normal. ;  Premandrake :Very good ! I never arrived to link asm source with VC6. And now, I have a fast memcpy.Namethatnobodyelsetook:Thanks a lot for the link.I have a last question:Do you think i can go faster with this style of memcpy than a page flipping in the video memory (using directX7) ?Chuck.   [edited by - Chuck3d on February 10, 2004 3:21:00 PM];1234