New function's UpperCase / LowerCase
- From: "Lars G" <lbg-at-aplusmail-dot-dk>
- Date: Mon, 27 Nov 2006 20:38:02 +0100
Hi
I think these function's without the lookup table runs reasonable fast on my
AMD64. But that about all the INTEL cpu's ?
I dont think this is the fastest function but small :-)
Regards,
Lars G
(*
Author: Lars Bloch Gravengaard
Date: 25/11 2006
Instructionset(s): PAS
Function size 79 bytes
*)
function UpperCase_LBG_Pas_1_a(const S: string): string;
const a=1;
var
Max, CharNo : Cardinal;
pResult : PChar;
begin
Max := Length(S);
SetLength(Result, Max);
if Max <= 0 then exit;
pResult := PChar(Result);
CharNo := 0;
repeat
pResult[CharNo] := S[CharNo+a];
if (S[CharNo+a] >= 'a') and (S[CharNo+a] <= 'z') then
pResult[CharNo] := char(Ord(S[CharNo+a]) - 32);
Inc(CharNo);
until(CharNo >= Max);
end;
(*
Author: Lars Bloch Gravengaard
Date: 25/11 2006
Instructionset(s): PAS
Function size 79 bytes
*)
function LowerCase_LBG_Pas_1_a(const S: string): string;
const a=1;
var
Max, CharNo : Cardinal;
pResult : PChar;
begin
Max := Length(S);
SetLength(Result, Max);
if Max <= 0 then exit;
pResult := PChar(Result);
CharNo := 0;
repeat
pResult[CharNo] := S[CharNo+a];
if (S[CharNo+a] >= 'A') and (S[CharNo+a] <= 'Z') then
pResult[CharNo] := char(Ord(S[CharNo+a]) + 32);
Inc(CharNo);
until(CharNo >= Max);
end;
.
- Follow-Ups:
- Re: New function's UpperCase / LowerCase
- From: John O'Harrow
- Re: New function's UpperCase / LowerCase
- Prev by Date: Re: Fastcode CharPosRev B&V 0.6.0
- Next by Date: Re: Delphi Versions Poll
- Previous by thread: FastMM4 - Help with shared memory ?
- Next by thread: Re: New function's UpperCase / LowerCase
- Index(es):
Relevant Pages
|