mparlak / Flee

Fast Lightweight Expression Evaluator
629 stars 120 forks source link

Long compares with values bigger UInt32.MaxValue does not work #83

Open benzmarkus opened 4 years ago

benzmarkus commented 4 years ago

Hi,

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

getting an Convert.ToInt32() exception.

hunkydoryrepair commented 3 years ago

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)));