* RTL, fpc_val_int64_shortstr and fpc_val_qword_shortstr: variable 'u' does not have to be 64-bit because it only takes values 0 to 15. Changing to sizeint improves code quality on 32-bit targets.

* fpc_val_uint_shortstr and fpc_val_qword_shortstr: variable 'prev' is not needed, removed.
* ShortCompareText: variable 'i' type changed from integer to sizeint; integer is 16-bit here, resulting in suboptimal code on non-x86.

git-svn-id: trunk@25159 -
This commit is contained in:
sergei 2013-07-22 10:13:03 +00:00
parent 6daadff427
commit b0153f1482

View File

@ -1113,7 +1113,6 @@ Function int_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; out Code
Function fpc_Val_UInt_Shortstr(Const S: ShortString; out Code: ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_SHORTSTR']; compilerproc;
var
prev : ValUInt;
base,u : byte;
negative : boolean;
begin
@ -1137,9 +1136,8 @@ begin
else
u:=16;
end;
prev := fpc_Val_UInt_Shortstr;
If (u>=base) or
(ValUInt(MaxUIntValue-u) div ValUInt(Base)<prev) then
(ValUInt(MaxUIntValue-u) div ValUInt(Base)<fpc_val_uint_shortstr) then
begin
fpc_Val_UInt_Shortstr:=0;
exit;
@ -1155,7 +1153,8 @@ end;
Function fpc_val_int64_shortstr(Const S: ShortString; out Code: ValSInt): Int64; [public, alias:'FPC_VAL_INT64_SHORTSTR']; compilerproc;
var u, temp, prev, maxprevvalue, maxnewvalue : qword;
var u : sizeuint;
temp, prev, maxprevvalue, maxnewvalue : qword;
base : byte;
negative : boolean;
@ -1211,7 +1210,7 @@ end;
Function fpc_val_qword_shortstr(Const S: ShortString; out Code: ValSInt): QWord; [public, alias:'FPC_VAL_QWORD_SHORTSTR']; compilerproc;
var u, prev: QWord;
var u : sizeuint;
base : byte;
negative : boolean;
@ -1238,9 +1237,8 @@ end;
else
u:=16;
end;
prev := fpc_val_qword_shortstr;
If (u>=base) or
((QWord(maxqword-u) div QWord(base))<prev) then
((QWord(maxqword-u) div QWord(base))<fpc_val_qword_shortstr) then
Begin
fpc_val_qword_shortstr := 0;
Exit
@ -1902,7 +1900,7 @@ end;
function ShortCompareText(const S1, S2: shortstring): SizeInt;
var
c1, c2: Byte;
i: Integer;
i: SizeInt;
L1, L2, Count: SizeInt;
P1, P2: PChar;
begin