From: Jackson Harper Date: Thu, 22 May 2003 03:42:07 +0000 (-0000) Subject: * ILParser.jay: When converting from int32 to int64 do an exact X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=071207398148cef50d105a89cc197a494a63f236;p=mono.git * ILParser.jay: When converting from int32 to int64 do an exact bit conversion, not a numerical conversion. svn path=/trunk/mcs/; revision=14791 --- diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog index 85b8dc85f38..26b105b923c 100644 --- a/mcs/ilasm/parser/ChangeLog +++ b/mcs/ilasm/parser/ChangeLog @@ -1,3 +1,8 @@ +2003-05-21 Jackson Harper + + * ILParser.jay: When converting from int32 to int64 do an exact + bit conversion, not a numerical conversion. + 2003-05-21 Jackson Harper * ILParser.jay: INT_I8s are not int instructions, currently the diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index 2d74d57a392..500748fb01b 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -2014,12 +2014,9 @@ comp_qstring : QSTRING int32 : INT32 | INT64 { - Int64 int64 = (Int64) $1; - - if (int64 > Int32.MaxValue) - $$ = Int32.MaxValue; - else if (int64 < Int32.MinValue) - $$ = Int32.MinValue; + long l = (long) $1; + byte[] intb = BitConverter.GetBytes (l); + $$ = BitConverter.ToInt32 (intb, 0); } ;