Hi all,

I don't know if rtl-optimilisation patches have a large priority, but
nevertheless this patch improves the speed of the sysutils.uppercase and
lowercase functions.

-- 
Met vriendelijke groeten,


Index: sysstr.inc
===================================================================
--- sysstr.inc	(revision 372)
+++ sysstr.inc	(working copy)
@@ -67,11 +67,8 @@
 var i: integer;
 begin
 result := S;
-i := Length(S);
-while i <> 0 do begin
+for i := Length(S) downto 1 do
    if (result[i] in ['a'..'z']) then result[i] := char(byte(result[i]) - 32);
-   Dec(i);
-   end;
 end;
 
 {   LowerCase returns a copy of S where all uppercase characters ( from A to Z )
@@ -81,11 +78,8 @@
 var i: integer;
 begin
 result := S;
-i := Length(result);
-while i <> 0 do begin
+for i := Length(S) downto 1 do
    if (result[i] in ['A'..'Z']) then result[i] := char(byte(result[i]) + 32);
-   dec(i);
-   end;
 end;
 
 {   CompareStr compares S1 and S2, the result is the based on
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to