diff --git a/rtl/i386/i386.inc b/rtl/i386/i386.inc index 24f05d841c..dbf5f1bfaa 100644 --- a/rtl/i386/i386.inc +++ b/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} diff --git a/rtl/inc/generic.inc b/rtl/inc/generic.inc index e910e0858e..2195fae23b 100644 --- a/rtl/inc/generic.inc +++ b/rtl/inc/generic.inc @@ -693,31 +693,19 @@ begin else exit(0); end; - -function fpc_shortstr_compare_equal(const left,right:shortstring) : longint;[public,alias:'FPC_SHORTSTR_COMPARE_EQUAL']; compilerproc; -var - s1,s2,i : byte; - d : longint; -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); -end; - - {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE} + +{$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 + 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} + + {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR} function fpc_pchar_to_shortstr(p:pchar):shortstring;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; compilerproc;