dualfroz 72e7db13fa #4136: Simplify bool-typed if (c) 1 else 0 to c != 0
An IfInstruction tests its condition for non-zero, so a bool-typed
`if (c) ldc.i4 1 else ldc.i4 0` always equals `c != 0`, which
ExpressionTransforms already folds to `c` for bool `c`. Without this
identity the node reached the C# output as `c ? true : false`, or as
`c || 1 == 0` once negated. The lost `??` form is not addressed here.
2026-10-10 13:50:53 +02:00
S
Description
My contributions to icsharpcode/ILSpy: 16 commits, 3 merged PRs
202 KiB
0 Stars 1 Watchers 0 Forks
Languages
C# 99.9%