Browse Source

* i386 uses generic fpc_compare_shortstr_equal

git-svn-id: trunk@6335 -
peter 18 years ago
parent
commit
cd767cf5c8
2 changed files with 8 additions and 28 deletions
  1. 0 8
      rtl/i386/i386.inc
  2. 8 20
      rtl/inc/generic.inc

+ 0 - 8
rtl/i386/i386.inc

@@ -937,14 +937,6 @@ asm
         movl    saveesi,%esi
         movl    saveebx,%ebx
 end;
-
-function fpc_shortstr_compare_equal(const left,right:shortstring): longint; [public,alias:'FPC_SHORTSTR_COMPARE_EQUAL']; compilerproc;
-begin
-  Result := longint(left[0]) - longint(right[0]);
-  if Result = 0 then
-    Result := CompareByte(left[1],right[1], longint(left[0]));
-end;
-
 {$endif FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
 
 

+ 8 - 20
rtl/inc/generic.inc

@@ -693,31 +693,19 @@ begin
   else
     exit(0);
 end;
+{$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
 
-function fpc_shortstr_compare_equal(const left,right:shortstring) : longint;[public,alias:'FPC_SHORTSTR_COMPARE_EQUAL']; compilerproc;
-var
-   s1,s2,i : byte;
-   d : longint;
+
+{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE_EQUAL}
+function fpc_shortstr_compare_equal(const left,right:shortstring): longint; [public,alias:'FPC_SHORTSTR_COMPARE_EQUAL']; compilerproc;
 begin
-  s1:=length(left);
-  s2:=length(right);
-  if s1<>s2 then
-    exit(-1)
-  else
-    for i:=1 to s1 do
-      begin
-       d:=byte(left[i])-byte(right[i]);
-       if d>0 then
-         exit(1)
-       else if d<0 then
-         exit(-1);
-      end;
-  exit(0);
+  Result := longint(left[0]) - longint(right[0]);
+  if Result = 0 then
+    Result := CompareByte(left[1],right[1], longint(left[0]));
 end;
+{$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE_EQUAL}
 
 
-{$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
-
 {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
 
 function fpc_pchar_to_shortstr(p:pchar):shortstring;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; compilerproc;