 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Adem Guest
|
Posted: Thu Apr 26, 2007 2:25 am Post subject: Some assemby rewuired: WideStrEnd() |
|
|
This is from D7.
Could someone please re-write this so that it uses PWideChar instead of
PChar.
function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;
TVMIA, |
|
| Back to top |
|
 |
Per Larsen Guest
|
Posted: Thu Apr 26, 2007 3:22 am Post subject: Re: Some assemby rewuired: WideStrEnd() |
|
|
"Adem" <adembaba (AT) excite (DOT) com> wrote in message
news:xn0f5eeqpf2dvr000 (AT) forums (DOT) borland.com...
| Quote: |
This is from D7.
Could someone please re-write this so that it uses PWideChar instead of
PChar.
function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;
TVMIA,
|
That should be something like
function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;
IHTH
- Per |
|
| Back to top |
|
 |
Adem Guest
|
Posted: Thu Apr 26, 2007 7:54 am Post subject: Re: Some assemby rewuired: WideStrEnd() |
|
|
Per Larsen wrote:
Thank you. It seems to work. Magic  |
|
| Back to top |
|
 |
PaJi Guest
|
Posted: Thu Apr 26, 2007 3:01 pm Post subject: Re: Some assemby rewuired: WideStrEnd() |
|
|
Hi all,
I think, you have to decrease the counter of the loop too.
You test word, not byte. Load max. $7FFFFFFF into register ECX.
I know that the chance is very low to reach maximum count,
but theoreticaly should be only $7FFFFFF.
MOV ECX,$7FFFFFFF
or
MOV ECX,7FFFFFFFh
The similar rule valids for StrLenW and for other similar wide functions.
function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,$7FFFFFFF
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;
Good luck.
PaJi.
------------------------------------
"Per Larsen" <perATportablemindsDOTcom> píše v diskusním příspěvku
news:462fd4b6 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Adem" <adembaba (AT) excite (DOT) com> wrote in message
news:xn0f5eeqpf2dvr000 (AT) forums (DOT) borland.com...
This is from D7.
Could someone please re-write this so that it uses PWideChar instead of
PChar.
function StrEnd(const Str: PChar): PChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
LEA EAX,[EDI-1]
MOV EDI,EDX
end;
TVMIA,
That should be something like
function StrEndW(const Str: PWideChar): PWideChar; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR EAX,EAX
REPNE SCASW
LEA EAX,[EDI-2]
MOV EDI,EDX
end;
IHTH
- Per
|
|
|
| Back to top |
|
 |
Per Larsen Guest
|
Posted: Thu Apr 26, 2007 5:05 pm Post subject: Re: Some assemby rewuired: WideStrEnd() |
|
|
"PaJi" <PaJi (AT) wo (DOT) cz> wrote in message news:4630786a (AT) newsgroups (DOT) borland.com...
| Quote: | I think, you have to decrease the counter of the loop too.
You test word, not byte. Load max. $7FFFFFFF into register ECX.
|
Now you're being very very picky, PaJi :)
- Per |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|