You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected fnFails to produce the same decompiled code as fnWorks. Only difference is the size of the constants, i.e. ldc.i4+conv.i8 vs ldc.i8.
Not sure what produces an IL i8 less than 2^31 (I tried marking a constant with 'L' suffix, but the compiler seemingly disregarded that), but that makes ilspy fail to include the required argument casts to long.
.method public hidebysig static int64 fnWorks (int32 x, int32 y) cil managed
{
.maxstack 8
ldarg.1
conv.i8
ldc.i4 16777215
conv.i8
and
ldc.i4.s 24
shl
ldarg.0
conv.i8
ldc.i4 16777215
conv.i8
and
or
ret
}
decompiled OK: return (((long)y & 16777215L) << 24) | ((long)x & 16777215L);
.method public hidebysig static int64 fnFails (int32 x, int32 y) cil managed
{
.maxstack 8
ldarg.1
conv.i8
ldc.i8 16777215
and
ldc.i4.s 24
shl
ldarg.0
conv.i8
ldc.i8 16777215
and
or
ret
}
decompiled bad: return ((y & 0xFFFFFF) << 24) | (x & 0xFFFFFF);
Another minor detail here, is that the failing case properly recognize that the constants are of form 2^n-1 and turns them into hex, but the working case (probably due to the conv.i8) does not.
The text was updated successfully, but these errors were encountered:
Expected fnFails to produce the same decompiled code as fnWorks. Only difference is the size of the constants, i.e.
ldc.i4
+conv.i8
vsldc.i8
.Not sure what produces an IL
i8
less than 2^31 (I tried marking a constant with 'L' suffix, but the compiler seemingly disregarded that), but that makes ilspy fail to include the required argument casts tolong
.Another minor detail here, is that the failing case properly recognize that the constants are of form 2^n-1 and turns them into hex, but the working case (probably due to the
conv.i8
) does not.The text was updated successfully, but these errors were encountered: