Ver Mensaje Individual
  #1  
Antiguo 22-02-2016
xangiesaurx xangiesaurx is offline
Miembro
NULL
 
Registrado: feb 2016
Posts: 57
Reputación: 11
xangiesaurx Va por buen camino
Uso de ASM en 64 bits

Hola que tal a todos, vengo con otra duda, tengo este código en mi código de Delphi de 32bits, pero ahora que estoy compilando en 64bits con Delphi XE5, me da errores, me preguntaba si alguno de ustedes podría ayudarme con esto.
Muchas gracias

Código:
function FastCpySSE(const D:Pointer; const S:Pointer; const count:dword):integer;
var dwNumElements, dwNumPacks:DWORD;
begin
 dwNumElements := count div sizeof(integer);
 // not really using it, just for debuging. it keeps number of looping.
 // it also means number of packed data.
 dwNumPacks := dwNumElements div (128 div (sizeof(integer)*8));

 asm
  // remember for cleanup
  pusha;
@@begin:
  // init counter to SizeInBytes
  mov  ecx,count
  // get destination pointer
  mov  edi,D
  // get source pointer
  mov  esi,S
@@begina:
  // check if counter is 0, yes end loop.
  cmp  ecx,0
  jz  @@end
@@body:
  // calculate offset
  mov  ebx,count
  sub  ebx,ecx
  // copy source's content to 128 bits registers
  movdqa xmm1,[esi+ebx]
  // copy 128 bits registers to destination
  movdqa [edi+ebx],xmm1;

@@bodya:
  // we've done "1 packed == 4 * sizeof(int)" already.
  sub  ecx,16;
  jmp  @@begina
@@end:
  // cleanup
  popa;
end;

 result := 0;;
end;
Responder Con Cita