mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 09:29:13 +02:00
* fixed bug for val when processing -2147483648 and low(int64) (merged)
This commit is contained in:
parent
0e8e9e4173
commit
0d5167e124
@ -392,13 +392,6 @@
|
||||
Code:=InitVal(s,negative,base);
|
||||
if Code>length(s) then
|
||||
exit;
|
||||
if negative and (s='-9223372036854775808') then
|
||||
begin
|
||||
Code:=0;
|
||||
ValInt64:=Int64($80000000) shl 32;
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ high(int64) produces 0 in version 1.0 (JM) }
|
||||
with qwordrec(maxint64) do
|
||||
begin
|
||||
@ -424,7 +417,7 @@
|
||||
Temp:=Temp*Int64(base);
|
||||
If (u >= base) or
|
||||
((base = 10) and
|
||||
(maxint64-temp < u)) or
|
||||
(maxint64-temp+ord(negative) < u)) or
|
||||
((base <> 10) and
|
||||
(qword(maxqword-temp) < u)) or
|
||||
(prev > maxqword div qword(base)) Then
|
||||
@ -486,7 +479,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2000-07-28 12:29:49 jonas
|
||||
Revision 1.4 2000-11-17 17:01:23 jonas
|
||||
* fixed bug for val when processing -2147483648 and low(int64) (merged)
|
||||
|
||||
Revision 1.3 2000/07/28 12:29:49 jonas
|
||||
* fixed web bug1069
|
||||
* fixed similar (and other) problems in val() for int64 and qword
|
||||
(both merged from fixes branch)
|
||||
|
@ -359,13 +359,6 @@ begin
|
||||
Code:=InitVal(s,negative,base);
|
||||
if Code>length(s) then
|
||||
exit;
|
||||
if negative and (s='-2147483648') then
|
||||
begin
|
||||
Code:=0;
|
||||
ValSignedInt:=$80000000;
|
||||
exit;
|
||||
end;
|
||||
|
||||
while Code<=Length(s) do
|
||||
begin
|
||||
case s[Code] of
|
||||
@ -379,7 +372,7 @@ begin
|
||||
Temp := Temp*ValUInt(base);
|
||||
If (u >= base) or
|
||||
((base = 10) and
|
||||
(MaxSIntValue-temp < u)) or
|
||||
(MaxSIntValue-temp+ord(negative) < u)) or
|
||||
((base <> 10) and
|
||||
(ValUInt(MaxUIntValue-Temp) < u)) or
|
||||
(prev > ValUInt(MaxUIntValue) div ValUInt(Base)) Then
|
||||
@ -560,7 +553,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2000-11-06 20:34:24 peter
|
||||
Revision 1.6 2000-11-17 17:01:23 jonas
|
||||
* fixed bug for val when processing -2147483648 and low(int64) (merged)
|
||||
|
||||
Revision 1.5 2000/11/06 20:34:24 peter
|
||||
* changed ver1_0 defines to temporary defs
|
||||
|
||||
Revision 1.4 2000/10/21 18:20:17 florian
|
||||
|
Loading…
Reference in New Issue
Block a user