Flee icon indicating copy to clipboard operation
Flee copied to clipboard

Long compares with values bigger UInt32.MaxValue does not work

Open benzmarkus opened this issue 5 years ago • 1 comments

Hi,

Following bool compare dos not work. "2432696330L = 2432696330L"

getting an Convert.ToInt32() exception.

benzmarkus avatar Oct 25 '20 19:10 benzmarkus

Verified. In LiteralElement.cs line 45 it attempts to convert to an Int32 if it is smaller than a UInt32, with predictable results. In order to output as it is needed, we need to do a conversion to Int32 in an unchecked manner:

ilg.Emit(OpCodes.Ldc_I4, unchecked((int)Convert.ToUInt32(value)));

hunkydoryrepair avatar Mar 26 '21 03:03 hunkydoryrepair