Skip to content

Commit 7218a63

Browse files
#3367: Extend range check to support negative integers.
1 parent c226e38 commit 7218a63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ICSharpCode.Decompiler/IL/Transforms/EarlyExpressionTransforms.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ bool TransformDecimalCtorToConstant(NewObj inst, out LdcDecimal result)
213213
int lo, mid, hi, isNegative, scale;
214214
if (args[0].MatchLdcI4(out lo) && args[1].MatchLdcI4(out mid) &&
215215
args[2].MatchLdcI4(out hi) && args[3].MatchLdcI4(out isNegative) &&
216-
args[4].MatchLdcI4(out scale) && scale <= 28)
216+
args[4].MatchLdcI4(out scale) && unchecked((byte)scale) <= 28)
217217
{
218-
result = new LdcDecimal(new decimal(lo, mid, hi, isNegative != 0, (byte)scale));
218+
result = new LdcDecimal(new decimal(lo, mid, hi, isNegative != 0, unchecked((byte)scale)));
219219
return true;
220220
}
221221
}

0 commit comments

Comments
 (0)