-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Closed
Copy link
Labels
Description
This seems to be a regression from the fixes for #1796
I've found two cases where uint casts and constant conversions to unsigned are unnecessary. Possibly also applies to other unsigned integral types.
Input code
Decompiler settings reset to default.
Source as entered in LINQPad 5:
int Foo(int x)
{
if ((x & 0x10) != 0)
return 1;
return 0;
}
byte Bar(int x)
{
return (byte)(x & 0x10);
}Assembly: query_jsdiku.zip
Erroneous output
Actual output:
private int Foo(int x)
{
if (((uint)x & 0x10u) != 0)
{
return 1;
}
return 0;
}
private byte Bar(int x)
{
return (byte)((uint)x & 0x10u);
}Expected output (as decompiled by ILSpy 6.1):
private int Foo(int x)
{
if ((x & 0x10) != 0)
{
return 1;
}
return 0;
}
private byte Bar(int x)
{
return (byte)(x & 0x10);
}Details
- Product in use: ILSpy
- Version in use: 6.2.0.6118-preview2