Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#78

AW: Anzahl eines Zeichens im String ermitteln

  Alt 13. Jul 2018, 13:40
Ich habe so ein bisschen das Gefühl, dass bei euch (aus welchem Grund auch immer) die Parameter nicht in den Registern ankommen wie es sein sollte/normalerweise ist.

Funktioniert diese Version bei euch?
Delphi-Quellcode:
function CharCountAsm(AStr: PChar; AChar: Char; len: Integer): Integer;
label loop_start, loop_ende, ende;
asm
  cld
  // Explizite Zuweisung der Parameter in die Register
  mov edi, AStr
  mov ax, AChar
  mov ecx, len
  xor edx, edx
loop_start:
  repnz scasw
  jcxz loop_ende
  inc edx
  jmp loop_start
loop_ende:
  jnz ende
  inc edx
ende:
  mov result, edx
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat